boost

Handle complex options with Boost's program_options

I have a program that generates graphs using different multi-level models. Each multi-level model consists of a generation of a smaller seed graph (say, 50 nodes) which can be created from several models (for example - for each possible edge, choose to include it with probability p). After the seed graph generation, the graph is expande...

C++ meta-splat function

Is there an existing function (in boost mpl or fusion) to splat meta-vector to variadic template arguments? For example: splat<vector<T1, T2, ...>, function>::type // that would be the same as function<T1, T2, ...> My search have not found one, and I do not want to reinvent one if it already exists. Alternatively, is there a solutio...

trouble with boost::filesystem::wrecursive_directory_iterator

I'm trying to write a program to help me manage my iTunes library, including removing duplicates and cataloging certain things. At this point I'm still just trying to get it to walk through all the folders, and have run into a problem: I have a small amount of Japanese music, where the artist and/or album is written in Japanese characte...

C++ auto function return type implementation [trailing-return-type]

hello. Is there macro, something like BOOST_AUTO, which would allow to emulate automatic return type deduction of function in C++? I mean something like trailing-return-type, http://en.wikipedia.org/wiki/C%2B%2B0x#Alternative_function_syntax this is what I have: using namespace boost::fusion; #define AS_VECTOR(var, expr) BOOST_AUTO(v...

boost::enable_if class template method

I got class with template methods that looks at this: struct undefined {}; template<typename T> struct is_undefined : mpl::false_ {}; template<> struct is_undefined<undefined> : mpl::true_ {}; template<class C> struct foo { template<class F, class V> typename boost::disable_if<is_undefined<C> >::type apply...

[C++] Write connected components of a graph using Boost Graph

I have an file that is a long list of weighted edges, in the following form node1_id node2_id weight node1_id node3_id weight and so on. So one weighted edge per line. I want to load this file into boost graph and find the connected components in the graph. Each of these connected components is a subgraph. For each of these compon...

List of functions references

Hello, I'm using boost::function for making references to the functions. Can I make a list of references? For example: boost::function<bool (Entity &handle)> behaviorRef; And I need in a list of such pointers. For example: std::vector<behaviorRef> listPointers; Of course it's wrong code due to behaviorRef isn't a type. So the ques...

Work with function references

Hello, I have another one question about functions reference. For example, I have such definition: typedef boost::function<bool (Entity &handle)> behaviorRef; std::map< std::string, ptr_vector<behaviorRef> > eventAssociation; The first question is: how to insert values into such map object? I tried: eventAssociation.insert(std::pair...

How to remove compiler flag when building Boost

I need to build Boost with a non-standard set of flags (due to a conflict between Boost threading and C++/CLI). I'm adding the required flag (/clr) using CXXFLAGS, but this flag conflicts with the Boost default /EHs flag (/clr implies /EHa which is incompatible with /EHs), so that needs to be suppressed. Is there a mechanism like CXXFL...

How to pass function reference into arguments

Hi, I'm using boost::function for making function-references: typedef boost::function<void (SomeClass &handle)> Ref; someFunc(Ref &pointer) {/*...*/} void Foo(SomeClass &handle) {/*...*/} What is the best way to pass Foo into the someFunc? I tried something like: someFunc(Ref(Foo)); ...

unique_ptr boost equivalent?

Is there some equivalent class for C++1x's std::unique_ptr in the boost libraries? The behavior I'm looking for is being able to have an exception-safe factory function, like so... std::unique_ptr<Base> create_base() { return std::unique_ptr<Base>(new Derived); } void some_other_function() { std::unique_ptr<Base> b = create_bas...

boost::filesystem - how to create a boost path from a windows path string on posix plattforms?

I'm reading path names from a database which are stored as relative paths in Windows format, and try to create a boost::filesystem::path from them on a Unix system. What happens is that the constructor call interprets the whole string as the filename. I need the path to be converted to a correct Posix path as it will be used locally. I ...

cannot not find library files in eclipse cdt

properties/C/C++ Build/Settings GCC C++ Linker/Libraries Under libraries(-I) I have libbost_system libbost_filesystem ... and under Library search path(-L) I have /home/etobkru/boost_1_43_0/boostBinaries/lib but when I compile I get g++ -L/home/etobkru/boost_1_43_0/boostBinaries/lib/ -o"searchDirs" ./main.o -llibboost_system -llib...

How do boost operators work?

boost::operators automatically defines operators like + based on manual implementations like += which is very useful. To generate those operators for T, one inherits from boost::operators<T> as shown by the boost example: class MyInt : boost::operators<MyInt> I am familiar with the CRTP pattern, but I fail to see how it works here. Spe...

How do I create a set with std::pair thats sorted based on the ::second pair member using bind

I know I could use the following: template <typename Pair> struct ComparePairThroughSecond : public std::unary_function<Pair, bool> { bool operator ()(const Pair& p1, const Pair& p2) const { return p1.second < p2.second; } }; std::set<std::pair<int, long>, ComparePairThroughSecond> somevar; but wondered if i...

What is the nicest way to parse this in C++ ?

Hi, In my program, I have a list of "server address" in the following format: host[:port] The brackets here, indicate that the port is optional. host can be a hostname, an IPv4 or IPv6 address (possibly in "bracket-enclosed" notation). port, if present can be a numeric port number or a service string (like: "http" or "ssh"). If p...

VC++ 2010 wants to link boost libararies i didn't even specify

Hi there, I'm trying to build my application with MSVC 2010 instead of GCC. With GCC everything works fine. My app uses boost_system and boost_thread libraries. I built boost with VC2010 in "system" layout, that means the libraries are named just libboost_system.lib (and not libboost_system_compiler_threading_version_wtf_snafu.lib) The...

Cant find libboost_system.so.1.43.0 in eclipse using boost

I am trying to run boost in eclipse, under Library search path I have put: /home/etobkru/boost_1_43_0/boostBinaries/lib/ and under Libraries I have put all the libs, boost_system, etc. The build is working without errors but when am trying to run the program I get an error: error while loading shared libraries: libboost_system.so.1.43...

What is your favorite/recommended project structure and file structure for Unit Testing using Boost ?

I have not used Unit Testing so far, and I intend to adopt this procedure. I was impressed by TDD and certainly want to give it a try - I'm almost sure it's the way to go. Boost looks like a good choice, mainly because it's being maintained. With that said, how should I go about implementing a working and elegant file-structure and proj...

accumulator don't compile

...