boost

How are attributes parsed in Boost.PropertyTree?

Say I have this XML format: <Widget type="SomeWidget" name="foo"> <Event name="onmouseover"> dostuff(); </Event> </Widget> How do I read the attributes using Boost.PropertyTree? ...

How to find programmatically out S/N ratio of a network?

Hi, I have a MANET and am writing an application which will be running on the base station and plugged into the TCP network. I wanted to know how can I figure out the signal-to-noise ratio of a selected node in the MANET? The GUI is based on Qt and I am also using BOOST which I don't have much experience with. I don't know where to st...

Build Boost.Context/Boost.Fiber/Boost.Task errors

Hello, I'm trying to build any of these and get various errors from Bjam. Configuration: Ubuntu 10.04 LTS, g++ 4.4.3, Intel Core 2 Duo CPU, Boost 1.44. I'm not familiar with Bjam; will appreciate any help. For Boost.Task: ./bjam toolset=gcc architecture=x86 instruction-set=i686 --with-task install results in: error: Duplicate name o...

boost::any, variants, calling functions based on arrays of them.

Given a set of functions, such as: template<class A1> Void Go(A1 a); template<class A1, class A2> Void Go(A1 a1, A2 a2); template<class A1, class A2, class A3> Void Go(A1 a1, A2 a2, A3 a3); Is it possible to take an array of some variant type and given its contents, fire the correct function? My application for this is that I want ...

Can't get NetBeans syntax highlighting with boost library

With NetBeans (v. 6.9.1) I cannot get syntax highlighting for the Boost library, i.e. all stuff present in Boost is not recognised. However the project is built correctly. I already set the paths in: NetBeans > Preferences > C/C++ > Code Assistance > C++ Compiler. Here I added the /usr/local/include path. The Boost headers are in /usr/...

Extract subset from boost dynamic_bitset

I need to extract and decode the bits (idx, idx+1, ... idx+n_bits) from a given boost dynamic_bitset. I have created the following solution: boost::dynamic_bitset<> mybitset(...); // build mask 2^{idx+n_bits} - 2^{idx} const boost::dynamic_bitset<> mask(mybitset.size(), (1 << idx+n_bits) - (1 << idx)); // shift the masked result idx tim...

Boost Try lock Assert

Hi, I am using boost::recursive_mutex. But when I use try_lock on this for the first time I am getting following error CollisionAvoidance: /usr/include/boost/thread/pthread/recursive_mutex.hpp:78: bool boost::recursive_mutex::try_lock(): Assertion `!res || res==16' failed. What is the reason for this? ...

Invoking a boost::function through boost::function_base

I have an unordered_map of functions that should be called on an object when an XML file is parsed. I have found that boost::function has a base class named boost::function_base, however as expected I cannot invoke it because I don't have the signuture of the function. Since all of those functions are setter functions, I can guarantee th...

question on assignment with boost::shared_ptr (vs. the reset() function)

Sorry if this is explicitly answered somewhere, but I'm a little confused by the boost documentation and articles I've read online. I see that I can use the reset() function to release the memory within a shared_ptr (assuming the reference count goes to zero), e.g., shared_ptr<int> x(new int(0)); x.reset(new int(1)); This, I believe ...

Code Blocks, Mingw, Boost, and static linking issues.

I am using Code Blocks with mingw and am trying to get a simple program to compile with static linking. I have build the boost libraries using these directions, here. Everything worked out fine and i was able to successfully compile this simple program (it compiles, i know it doesn't work because it exits before the message is sent to ...

Boost + Visual Studio 2010 + Windows Platform SDK 7.1

Could someone tell me a command line switch for bjam or something else that will make boost compile with VS2010 using the new Windows Platform SDK 7.1 toolchain? It's an option you can set in a normal visual studio project. The default is v100 a variant of the platform 7.0 toolchain. Thanks in advance. ...

Boost xpressive ! operator not working

I just started using Boost::xpressive and find it an excellent library... I went through the documentation and tried to use the ! operator (zero or one) but it doesn't compile (VS2008). I want to match a sip address which may or may not start with "sip:" #include <iostream> #include <boost/xpressive/xpressive.hpp> using namespace boos...

How to determine the Boost version on a system?

Is there a quick way to determine the version of the Boost C++ libraries on a system? ...

Does Boost.Serialization serialize differently on different platforms?

I use Boost.Serialization to serialize a std::map. The code looks like this void Dictionary::serialize(std::string & buffer) { try { std::stringstream ss; boost::archive::binary_oarchive archive(ss); archive << dict_; buffer = ss.str(); } catch (const std::exception & ex) { throw DictionaryException(ex.what()); ...

Does the boost library depend on the std C++ library?

We're needing to write small fast code on the windows platform and I know that boost in some instances has header only implementations. These need to be small for a reason, so we've been careful not to use the std C++ libraries actually because of size. My question is, does using boost asio or system also haul in the std C++ libraries ...

Boost Graph Library Undirected Graph No parallel edges enforcement

I'm using the Boost Graph Library to process an undirected graph, and declared my graph has typedef property<vertex_index_t, int, property<vertex_name_t, string> > VertexProperty; typedef adjacency_list<vecS, setS, undirectedS, VertexProperty > UndirectedGraph; As you can see, the OutEdgeList is of the type std::set and I chose it b...

Getting boost::function arity at compile time?

I need to make a decision in a BOOST_PP_IF statement based on the arity (parameter count) of a boost::function object. Is this possible? boost::function_types::function_arity does what I'm looking for, but at runtime; I need it at compile time. ...

C++ Compile-Time string manipulation

I looked at boost's mpl::string, but there doesn't seem to be an easy way of converting string literals to the single-quotation-integer-based format of mpl::string. What I am trying to do is to generate at compile time an XML realization of some simple data structures using compile time strings. I am striving for having macros generate t...

Linking against boost barfs with 'undefined reference to `boost::system::get_system_category()'

Hi, I'm having trouble statically linking an app which uses the boost 1.35 libraries. I'm using a linux debian Lenny box, with G++ 4.3.2. Linking without -static works without a hitch. Specifically, g++ -Wall -Wextra -pedantic -ggdb3 -O0 -static -l boost_thread-mt -lboost_system-mt -lboost_program_options-mt -lssl -lpthread -l crypt...

boost::interprocess::string conversion to char*

Is it possible to convert a boost::interprocess::string to an std::string or to a const char*? Something like c_str()... E.g.: boost::interprocess::string is = "Hello world"; const char* ps = is.c_str(); // something similar printf("%s", ps); I could even get a copy of the string in a non-shared memory block. E.g.: boost::interp...