boost

C++ boost variant question

Hello! I know that boost::variant uses boost::mpl stuff behind it and has a mpl-compatible typedef types. Let's say I have a simple typedef: typedef boost::variant<bool, int> Variant; Now I have another template function, let's say: template <typename T> T function() { // ... } I want this function to act differently for two ca...

boost condition. What am I doing wrong?

boost::condition_variable cond; boost::mutex mut; void Database::run() { boost::unique_lock<boost::mutex> lock(mut); while(true) { while(queries_queue.empty()) cond.wait(lock); mysqlpp::Query* q = queries_queue.front(); // <<< CRASHES HERE <<< q->execute(); queries_queue.pop_fron...

shared_ptr allocation optimization

Somewhere I saw a post about an optimized way of creating a boost shared_ptr so that it allocated the ptr plumbing and the pointee at the same time. I did a SO search but there are a lot of posts on shared_ptr and I could not find it. Can somebody smart please repost it edit: thanks for answer. extra credit question. Whats the correct (...

Boost C++ Libraries: Unit Test Assertion on % Processor Usage

I'm writing a unit test with Boost.Unit, and the code I'm testing must not exceed 50% of a single CPU during a portion of the unit test. How could I make this assertion from within the source code? ...

Boost C++ Libraries: Unit Test Assertion on Deadlocks

I'm writing a unit test with Boost.Unit, and I would like to include basic tests for deadlocks in the code I'm testing. My first idea was to set a deadline timer in one thread while running the test in another that is expected to finish well before the deadline. When the timer goes off, assert that the thread is not running or not interr...

MySQL++ Warning

c:\program files\microsoft visual studio 9.0\vc\include\result.h(212) : warning C4275: non dll-interface class 'std::_Container_base_aux' used as base for dll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>' 1> with 1> [ 1> _Alloc=std::allocator<mysqlpp::Row> 1> ] 1> C:\Program Files\Mi...

List active handlers in boost io_service

Whilst building unit tests for a client/server system at work, I ran into a problem where my io_service was not releasing after I had shutdown all the active handlers (that I was aware of). After a day of trawling through code, I came across the errant handler which had not been integrated into my client shutdown procedures. My questio...

Trying to install boost libraries, not working?

I download the file where it says 'download now' from: http://sourceforge.net/projects/boost/files/boost/ when i unzip, there's a small .exe file. I run this (and also as administrator) a command prompt pops up and disappears instantly. Yet everywhere i read i should be getting licence agreement etc. Im on Win 7 64? Help :) ...

C++ boost enable_if question

Hello! Do I have any way to simplify the following statements? (probably, using boost::enable_if). I have a simple class structure - Base base class, Derived1, Derived2 inherit from Base. I have the following code: template <typename Y> struct translator_between<Base, Y> { typedef some_translator<Base, Y> type; }; template <typen...

Drupal Poll and Boost and XSS injection

Hello, I'm having problem on adding more options to Drupal Poll without disabling the Jsvascript of my browser. I also received this error when I try to clear the Boost Cache and I received this error - FormAPI Bug Encountered; trying to work around the bug. Given: 0 Wanted: 4. Also, I can see several xxxx in our watchdog. Any help from...

Convert date object to string in boost

Hi, Using the boost library how would I convert a date object: date d(2010,10,01); to a string with the format: DD-mmm-YYYY, so that variable d would become "01-Oct-2010". Now there are number of functions for converting a date object to a string such as std::string to_simple_string(date d) which returns a string in the ...

Would using a library like Boost be acceptable at work? (C++)

Possible Duplicate: Is there a reason to not use Boost? In my distaste for over-re-using small libraries that I had designed for different purposes (filesystem, network etc) for each project I had become to like the taste of using a larger general purpose library such as Boost. If it saves time (and money depending on the ge...

boost library..........pre-built variants??

Hi, im just installing the boost library using an installer. Its asking me which variants (about 8 options, 6 multithreaded and 2 single threaded) do i want to install. Im only installing this to get to grips and have a practice with boost, so im unsure? Also, how do i use the libraries from VS02010 once ive 'installed' them using the ...

Cmake doesn't find Boost

Hello I'm trying to configure a project using CMake, but it fails to find Boost libraries even though they are in the specified folder. I have specified Boost_INCLUDE_DIR, Boost_LIBRARYDIR and BOOST_ROOT , but I still get an error saying that CMake is not able to find Boost. What could be the reason of such error? ...

Restricting template instantiation using is_integral / BOOST_STATIC_ASSERT

I am trying to implement a free operator function in order to stream values of arbitrary data type into some container class (DataVector). I did a template for basic data types and some specializations for the complex data types used in my project (examples covers std::string only). To make sure the template won't be used with a data typ...

C++: How to modify a files 'created' timestamp?

I need to modify the 'created' (if exists), 'modified' and 'accessed' timestamps of a file. Ideally this would be a platform-independent solution. I've looked around the boost libraries but I can't see anything relevant. The nearest I've found to something relevant is this for Windows. Can anyone help? Thanks. ...

Lua or Python binding with C++

I have used Lua.NET on .NET platform and I could call the .NET class/object from Lua and I could call the Lua from .NET Lua API interface. I did the same with the IronPython. I knew the how the .NET binding works. Now I have a C++ project and I want to use the dynamic capabilities. I want to call C++ object which may not be possible fr...

Boost Intrusive List hook

What is the difference in a base hook and a member hook in Boost::Intrusive library and when is one better to use then the other? I've read the boost documentation, but its not that explanatory. ...

Should I use boost::ptr_vector<T> or vector<boost::shared_ptr<T> >?

I need a container of pointers. Would you recommend boost::ptr_vector<T> or std::vector<boost::shared_ptr<T> >? (Or something else?) If that's of interest, my actual data structure is relatively complicated (see here) and currently stores objects, not pointers, but i'd like to change that (using pointer containers), in order to get rid ...

Boost Libraries: Unable to link regex library on MAC OS X

I'm trying to use the Boost Libraries ... but to no avail. I attempted to follow the Getting Started tutorial on Boost's website (for Unix Variants), but having problems along the way. I compiled the libraries into a directory in my Downloads folder: /Users/myUsername/Downloads/boostCompiled When I use the full path to the library .....