boost

How to initialize with multiple return values in c++(0x)

tuple in boost and TR1/c++0x provides a convenient (for the writer of the function) method to return two values from a function--however it seems to damage one major feature of the language for the caller: the ability to simply use the function to initialize a variable: T happy(); const auto meaningful_name(happy()); // RVO means no exc...

using static_cast with boost::bind

I want to transform a vector of type T to a vectorof type K. I tried this, but it doesn't work: transform(vec.rbegin(),vec.rend(),vecNew.begin(),boost::bind(static_cast<K>(),_1)); I get the error: "expected primary-expression before ‘)’ token". What am I doing wrong? ...

Building a boost application using a Makefile and MinGW (Undefined references)

Okay so I have the following makefile CC = g++ #CFLAGS = -g -Wall CFLAGS = -g LDFLAGS = -lm #client : shared.lib #server : shared.lib shared : src/shared/opcode.h $(CC) $(CFLAGS) -I./src/ -I./lib/boost/ -L./lib/boost/stage/lib/ -L./lib/win_sdk/ \ -D_WIN32_WINNT=0x0501 \ -lWS2_32 \ -lboost_system-mgw34-mt-1_43 \ -lboos...

How to force Boost to use rpath?

I have to build Boost outside the "usual" directory tree (i.e., /custom/dir instead of /usr), which is not that much of a problem: Just pass --prefix=/custom/path to ./runscript.sh / ./bjam, and there you go. Or so I thought. The problem is that some of the Boost libraries depend on each other, and - using the default build process goi...

Assign in Boost::Asio::Stream_Handle calling convetion crash

I am trying to create a Stream_Handle for a harddisk device. Here is the piece of code. ntStatus = NtCreateFile(source, DesiredAccess, &oa, &ios, NULL, FileAttributes, ShareAccess, CreateDisposition, CreateOptions, NULL, 0); //Create ReadStream boost::asio::io_service io_service; boost::asio::windows::stream_handle...

Why does `myvector.push_back(autoPtr.release())` provide the strong exception safety guarantee?

EDIT: I should've mentioned, I was looking at the documentation for Boost's ptr_sequence_adapter and it claims that their adapter for template< class U > void push_back( ::std::auto_ptr<U> x ); is equivalent to doing vec.push_back(autoPtr.release()); and also provides the strong exception guarantee. And then I realized I was confusing t...

boost gzip reading files with trailing garbage

Hey, I'm using boost::iostreams::gzip_decompressor with boost::iostreams::filterimg_streambuf to read gzip files. some of my files have what zcat calls trailing trash % zcat somefile data data data gzip: somefile: decompression OK, trailing garbage ignored What I want is for boost gzip to behave the same way. When trying to decom...

Adding static member variable to third-party class

I'm using Boost.Property_Tree for a project and I want to add a small bit of functionality to it. I want to add a "fromFile" static member variable that will figure out the file type and then use the proper parser. In my project, this is currently how I've got it. typedef boost::property_tree::ptree ConfigNode; Then I have another cla...

Use of Boost Bimap in C++

C++ Boost has Bimap container that is a bidirectional map: http://www.boost.org/doc/libs/1_43_0/libs/bimap/doc/html/index.html Does anyone know the performance of Boost::bimap? I mean what's the time complexity of accessing an element in the map? Is it as quick as unordered_map access (which is O(1))? Thanks! ...

Using boost memory pool in class

I tried to declare a memory pool in my class. But the compiler shows some basic error like missing ')' before ';' or syntax error : 'sizeof' It works well if I used the pool as local variable but I really want to make it live with the class. What's wrong about my usage? Here is the class, the MAX_OBJ is a const class CData { publi...

How do I create overloaded operators for boost pointers in C++?

From this post I see that you can't overload operators for pointers: http://stackoverflow.com/questions/1419997/c-operator-overloading-of-for-pointers-to-objects But is there any way I could overload operators for boost pointers? For example: boost::shared_ptr<ClassB> operator||(boost::shared_ptr<ClassA> lhs, boost::shared_ptr<ClassA...

c++ QThread and boost call back functions

Hello, I would like to know whether there is any way to check the validity of a boost call back function. Issue is as follows class A; class B; In class A's initialise function following is done. boost::function < void(class B) > call_back; using namespace boost::lambda; call_back = bind(&A::callback_after_preparation, this, boos...

boost or openMP for multithreading?

Hi, i have to parallize some code and a fried of mine suggested using boost for it. Right now i have a look into openMP and i am wondering what you think is better for that task. ...

BrainBench employment test

I have been asked by one of my potential employers to undertake a brainbench test for Boost (position is for C++ programmer). I have never heard/seen a brainbench test for Boost. Brainbench's website also doesn't have any hint. I was wondering perhaps it is some sort of customized solution for employers. My question, however is, what ca...

Convert boost::uuid to char*

I am looking to convert a boost::uuid to a const char*. What is the correct syntax for the conversion? ...

Boost Python (Suse and Ubuntu)

Hi, I created a simple .so library containing definition of a C++ class which should be accessed from Python and used for this purpose boost python library. When I'm testing this library using x64 Ubuntu it is enough to set LD_LIBRARY_PATH with the path to boost libs before running python. It doesn't work, however, when I'm using x64 Sus...

Building a project with Boost dynamic libraries disabled

I'm trying to build the open source project VMWare open view client. The problem I'm having is I can build it following their instructions however my build does not include all the depedencies and thus when I go to deploy it there is a failure saying missing libboost_signals-gcc41-1_34_1.so.1.34.1. According to their forums someone sug...

How to use boost::object_pool<>::construct with a non const reference as a ctor parameter?

Is it somehow possible to use boost::object_pool<>::construct with non const references? The following snippet doesn't compile (VS2010): foo::foo(bar & b) { } static boost::shared_ptr<foo> foo::create(bar & b) { return boost::shared_ptr<foo>(foo_pool.construct(b), boost::bind(& boost::object_pool<foo>::destroy, & foo_pool, _1));...

data repository based on std::map and boost::any: conversion errors

Hi, I am trying to implement a handy data repository or knowledge base for a little program of mine. I use a std::map of boost::any's to hold various pieces of information. For debugging and safety purposes, I have an extra safe accessor ''getVal()'' for the data. A snippet says more than a thousand words: EDIT: <<< Old snippet replac...

old gcc version for boost

When I try to use boost on an old Linux system, I get the message: Compiler not configured - please reconfigure The version of my gcc is: gcc version 2.9-gnupro-99r1 And in boost's gcc.hpp file I see: // versions check: // we don't know gcc prior to version 2.90: #if (__GNUC__ == 2) && (__GNUC_MINOR__ < 90) # error "Compile...