boost

Get Current Timezone In Boost

In most of the example I had seen, time_zone_ptr zone( new posix_time_zone("MST-07") ); But, I just want to get the current time zone for my running machine. I do not want to hard code the time zone name. May I know how can I do so in boost? ...

Boost Unit testing with Allegro Graphics Library

I'm trying to use boost unit testing alongside the Allegro graphics library, but both require main() alterations / overwrites. Has anyone had any experience using both? Edit 1/29/2010: I've refrained from selecting an answer until I can verify one or another, and due to the... sparse nature of the answers. ...

How to make a Debian package depend on multiple versions of libboost.

I have a debian/control file which includes: Build-Depends: ... libboost1.35-dev, libboost-date-time1.35-dev, ... This stops the package from building on modern Ubuntu systems. I could just change all the 1.35s for 1.38s and then it would work on modern Ubuntu, but not older versions. I would like to do something like: Build-Depend...

Avoiding indirect cyclic references when using shared_ptr and weak_ptr

I'm currently putting together an application that relies heavily on shared_ptr and everything looks good so far - I've done my homework and have a pretty good idea of some of the pitfalls of using shared_ptrs. One of the most recognised problems with shared_ptr is cyclic dependencies - these issues can be solved by storing weak_ptrs th...

Performance issue with graph incremental construction

I am working on a software where i have to create a graph (using boost::adjacency_list). The incremental insertion of vertices takes an extremely long time. Until now, i hadn't worked on the issue, because the use of STLport made this problem go away. I have now migrated my work to Visual Studio 2008, but can't take the time to go on us...

How can I make sure a boost::optional<T> object is initialized in release-build?

When trying to get the value of a boost::optional object, BOOST_ASSERT is used to make sure the object is indeed initialized. But what I would like when dereferencing an uninitialized optional is for an exception to be thrown - is there any way to get this behaviour in a release build? If not, is there any other similar library which h...

Are there any downsides with using make_shared to create a shared_ptr

Are there any downsides with using make_shared<T>() instead of using shared_ptr<T>(new T). Boost documentation states There have been repeated requests from users for a factory function that creates an object of a given type and returns a shared_ptr to it. Besides convenience and style, such a function is also exception s...

Boost::Python, static factories, and inheritance.

So I may have a rather unique use case here, but I'm thinking it should work- But it's not working correctly. Basically, I have a class that uses a static factory method ( create ) that returns a shared_ptr to the newly created instance of the class. This class also has a virtual function that I'd like to override from python and call f...

How to extract boost interprocess library?

Hello, I have a small project, that is using only the boost::interprocess part from boost library. Is there an easy way of extracting all needed files only for that part of library? Thanks in advance ...

Lazy/multi-stage construction in C++

What's a good existing class/design pattern for multi-stage construction/initialization of an object in C++? I have a class with some data members which should be initialized in different points in the program's flow, so their initialization has to be delayed. For example one argument can be read from a file and another from the network...

templated member function to boost multi index container

Hi, I have a boost multi index container thus. using namespace boost::multi_index; template < typename O > class Container { public: multi_index_container< O, indexed_by< ordered_unique< const_mem_fun< O, std::string, &O::name > > > > _container; }; As you can se...

Aid in building boost asio ssl example

I have been working through the asio ssl examples (linked below). Despite by best efforts I have been unable to link openssl into the boost example. The output from ld is that ld is missing symbols from libssl.a. The thing that I can not figure out is that I found all the symbols in libssl.a with nm that ld says are missing. I suspect I ...

Boost, bjam, and symbolic links

Hello, I generated some Boost librairies with bjam, and I get many symbolic links. For date_time : libboost_date_time-gcc41-mt-1_39.a libboost_date_time-gcc41-mt-1_39.so -> libboost_date_time-gcc41-mt-1_39.so.1.39.0 libboost_date_time-gcc41-mt-1_39.so.1.39.0 libboost_date_time-gcc41-mt.a -> libboost_date_time-gcc41-mt-1_39.a libbo...

Boost::bind a method with boost::function parameter

I would like to provide an extra boost::function to a async_write. I want the connections own HandleWrite function to be called first and then call the provided boost::function. Member method of Connection that binds to asio async_write void Connection::HandleWrite( const boost::system::error_code& e, boost::function<void (con...

Does dispatching on a Boost variant type take linear time ?

How efficient is dispatching on a boost::variant ? If it's a switch statement, it should only take O(1) time, but as far as I know, template metaprogrammign can only generate if's, which would put boost::variant dispatchs at a runtime overhead of O(n), where n = number of types in the variant. Can anyone confirm/deny/enlighten me on th...

Connected Component Labeling in C++

I need to use the connected component labeling algorithm on an image in a C++ application. I can implement that myself, but I was trying to use Boost's union-find/disjoint sets implementation since it was mentioned in the union-find wiki article. I can't figure out how to create the disjoint_sets object so that it'll work with the image...

Boost weak_ptr's in a multi-threaded program to implement a resource pool

I'm thinking of using boost::weak_ptr to implement a pool of objects such that they will get reaped when nobody is using one of the objects. My concern, though, is that it's a multi-threaded environment, and it seems there's a race condition between the last shared_ptr to an object going out of scope and a new shared_ptr being construct...

is this a correct use of boost condition variables?

Hi Everyone, I wrote the following program for alternatively incrementing and doubling a counter(increment first) using boost condition variables. Can any one tell me if this is the correct use of boost condition variables. It is working correctly. I don't understand the use of lock in wait function call. What does condition.wait(lock) m...

Use Boost to get arity and paramerter types of member function? (boost::function_traits)

It works just fine, for plain vanilla functions. The code below works just fine. It prints just what is should: int __cdecl(int, char) 2 int,char #include <boost/type_traits.hpp> #include <boost/function.hpp> #include <boost/typeof/std/utility.hpp> #include <iostream> using std::cout; using std::endl; int foo(int, char) { retu...

Error while compiling simple code in boost. How to find the name of the library ?

http://www.boost.org/doc/libs/1_38_0/doc/html/boost_asio/example/allocation/server.cpp g++ -L./lib/boost_1_41_0/ -L./lib/soci-3.0.0/ -L/usr/lib/ -L/usr/local/lib/ -L./ -I/usr/include -I./lib/boost_1_41_0 -o main server.o -lssl -pthread server.o: In function `error_code': /test/mycode/./lib/boost_1_41_0/boost/system/error_code...