boost

lambda bind problem?

Hello, I am a new beginner with boost. And here is my test code, using namespace boost::lambda; std::vector<std::string> strings; strings.push_back("Boost"); strings.push_back("C++"); strings.push_back("Libraries"); std::vector<int> sizes; std::for_each( strings.begin(), strings.end(), bind( &std::vector<...

how to efficiently parse date time (boost)

I have a char * with a date string I wish to parse. In this case a very simple format: 2010-10-28T16:23:31.428226 (common ISO format). I know with Boost I can parse this, but at a horrible cost. I have to create a string-stream, possibly a string, and then copy data back and forth. Is there any way to parse the char * without allocating...

Creating a spanning tree using BGL

I have a BGL graph and want to create a spanning tree using BGL. Starting from a specified vertex, I want to add the shortest edge to my graph which connects with this vertex. From there on, I want to always pick the shortest edge which connects with the graph which exists thus far. So, I want to add the constraint that every new edge ...

Is it possible to iterate an mpl::vector at run time without instantiating the types in the vector?

Generally, I would use boost::mpl::for_each<>() to traverse a boost::mpl::vector, but this requires a functor with a template function declared like the following: template<typename T> void operator()(T&){T::staticCall();} My problem with this is that I don't want the object T to be instantiated by for_each<>. I don't need the T parame...

Boost.MultiArray Beginner: How to get a 4D-Array with dynamic inner-array-sizes?

Hello, i want to store some kind of distance-matrix (2D), where each entry has some alternatives (different coordinates). So i want to access the distance for example x=1 with x_alt=3 and y=3 with y_alt=1, looking in a 4-dim multi-array with array[1][3][3][1]. The important thing to notice is the following: the 2 most inner arrays/vect...

Passing only an element of a std::vector property to a BGL algorithm

I have a graph with multiple edge weightings stored as namespace boost { enum edge_weightvector_t { edge_weightvector = 1337 }; BOOST_INSTALL_PROPERTY(edge, weightvector); } typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::property<boost::ed...

Boost wregex throwing exception, regex syntax wrong?

Hi, I have imported Boost library in to a .dll that I am using. I am trying to parse a string using: boost::wregex regPlayerAtSeat(L"*Governor: Seat.?[1-9].*"); But all I get is an 'interop service exception. Is the syntax of my regex wrong? Thanks, R. ...

Boost regex incorrect syntax

Hi, I am using the Boost library under c++ to parse a load of text. I seem to be having a problem with this string text text text Seat 6: player_name (11,111) text text text I am trying to match on the middle bit, the seat number can be anything between 1 and 9, the player_name can be any character a-zA-Z and include numbers *_. an...

Boost.Program_options syntax

I'm currently reading the Boost.Program_options tutorial. Here is some of the code they introduce: // Declare the supported options. po::options_description desc("Allowed options"); desc.add_options() ("help", "produce help message") ("compression", po::value<int>(), "set compression level") ; I understand the purpose behind ...

How to release the reference of bind arguments boost::signals2::signal keeps?

I found some objects in my C++ program can't be released due to the Signal2 of boost won't release those arguments in object created by boost::bind. Here is the code to reproduce the problem: #include <iostream> #include <string> #include <boost/bind.hpp> #include <boost/signals2.hpp> #include <boost/shared_ptr.hpp> using namespace s...

How to enumerate a BOOST_ENUM with BOOST_FOREACH ?

Hi, Can somebody please explain me how to enumerate a BOOST_ENUM using BOOST_FOREACH ? The example below show that I got it to work with std::for_each, but not with BOOST_FOREACH. Sample code : BOOST_ENUM_VALUES( MyEnum, const char *, (xMin)("xMin") (xMax)("xMax") (yMin)("yMin") (yMax)("yMax") ); void bla...

Is it possible to use boost::serialization with managed class?

We have a lot of native c++ classes that are serialized perfectly using boost::serialization. Now we want to change some of their member fields to property, so we could use them in PropertyGrids. When we changed the class definiction to ref class X, we got a huge number of these compilation errors: #1: error C2893: Failed to specialize...

Logging Guard to limit semi-constant log messages

I'm using boost log in my application for logging. However, in some sections of my code I have some log statements that could occur very often if something goes wrong. I'd want some kind of guard that can limit log messages when it detects that the same log message appears constantly. e.g. (This is a simplified example, not actual impl...

boost::thread and template functions

I am trying to run a template function on a separate thread but IntelliSense (VC++ 2010 Express) keeps giving me the error: "Error: no instance of constructor "boost::thread::thread" matches the argument list" and if I try to compile I get this error: "error C2661: 'boost::thread::thread' : no overloaded function takes 5 arguments" The ...