boost

Boost singletons

Hi guys, at this page: http://torjo.com/tobias/index.html#boost_utility_singleton._usage I saw that boost has singleton class which gets second param: recreate instance if it's deleted (when we call the singleton). I can't find the implementation of this singleton in boost library. There is only singletons from serialization and pool. Wh...

error: typedef name may not be a nested-name-specifier

I am trying to do something along the lines of this answer, and struggling: $ gcc --version gcc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4) file.cpp:7: error: template argument 1 is invalid file.cpp:7: error: typedef name may not be a nested-name-specifier And the offending part of the file: template <class R, class C, class T0=void, cl...

C++ boost ublas + units dimension constraints

hello. I am seeking advice on design/general idea on how to force matrix dimension constraints on ublas matrix/vector possibly using boost units. For example, let matrix A have dimensions of time x force (for example) // does not have dimensions, time x force and force x time are not distinguished. matrix<double> A; //something like?...

Can't figure out where race condition is occuring

I'm using Valgrind --tool=drd to check my application that uses Boost::thread. Basically, the application populates a set of "Book" values with "Kehai" values based on inputs through a socket connection. On a seperate thread, a user can connect and get the books send to them. Its fairly simple, so i figured using a boost::mutex::scope...

gcc c++ command line error-message parser

Are there any programs for parsing and displaying in a nice format the c++ error messages generated by gcc. I'm really looking for something like less that I can pipe my errors into that will collapse the template parameter lists by default, maybe with some nice highlighting so that my errors are actually readable. (Yes, it's boost's ...

boost::unordered_map is... ordered?

I have a boost::unordered_map, but it appears to be in order, giving me an overwhelming feeling of "You're Doing It Wrong". Why is the output to this in order? I would've expected the underlying hashing algorithm to have randomized this order: #include <iostream> #include <boost/unordered_map.hpp> int main() { boost::unordered_map<...

Passing template into boost function

template <class EventType> class IEvent; class IEventable; typedef boost::function<void (IEventable&, IEvent&)> behaviorRef; What is the right way for passing template class IEvent into boost function? With this code I get: error: functional cast expression list treated as compound expression error: template argument 1 is invalid err...

C++ link error for boost::filesystem

global destructor keyed to (commands.cpp) undefined reference to boost::system::get_system_category() How to resolve this error? ...

Serialize boost array

I would like to serialize a boost::array, containing something that is already serializable. If get this error: error C2039: 'serialize' : is not a member of 'boost::array<T,N>' I have tried to include the serialization/array.hpp header but it did not help. Is there another header to include ? Thanks EDIT: Removed a wrong link ...

buffer overflow with boost::program_options

Hello, I have a problem using boost:program_options this simple program, copy-pasted from boosts' documentation : #include <boost/program_options.hpp> int main( int argc, char** argv ) { namespace po = boost::program_options; po::options_description desc("Allowed options"); desc.add_options() ("help", "produce h...

Boost signals and passing class method

Hello, I've defined some signal: typedef boost::signals2::signal<void (int temp)> SomeSig; typedef SomeSig::slot_type SomeSigType; I have some class: class SomeClass { SomeClass() { SomeSig.connect(&SomeClass::doMethod); } void doMethod(const SomeSig &slot); }; And got a lot of errors: error: ‘BOOST_PP_ENUM_SHIFTE...

How do I cast Qt's QVariant to boost::any?

How do I cast Qt's QVariant to boost::any? ...

Trouble with boost signals

Hello, I have such situation in boost and C++: // Somewhere: typedef boost::signals2::signal<void (int KeyCode)> SigKeyPressed; typedef SigKeyPressed::slot_type SigKeyPressedType; class InputSystem { private: static SigKeyPressed mSigKeyPressed; public: static boost::signals2::connection keyPressed(const SigKeyPressed...

typedef boost::shared_ptr<MyJob> Ptr; or #define Ptr boost::shared_ptr

I've just started working on a new codebase where each class contains a shared_ptr typedef (similar to this) like: typedef boost::shared_ptr<MyClass> Ptr; Is the only purpose to save typing boost::shared_ptr? If that is the case, is the only reason not to do #define Ptr boost::shared_ptr in one common header the general problem...

any stl/boost functors to call operator()

template <typename T> struct Foo { void operator()(T& t) { t(); } }; Is there any standart or boost functor with the similar implementation? I need it to iterate over container of functors: std::for_each(beginIter, endIter, Foo<Bar>()); Or maybe there are other way to do it? ...

Storing objects in the array

Hello, I want to save boost signals objects in the map (association: signal name → signal object). The signals signature is different, so the second type of map should be boost::any. map<string, any> mSignalAssociation; The question is how to store objects without defining type of new signal signature? typedef boost::signals2::signal...

Tips for submitting a library to Boost?

Hi everyone, Summer is coming, and a group of friends and I are getting ready for it :) We decided to build a compile-time Arbitrary precision Unsigned Integers. We would like to provide a set of integers algorithms(functions) with the library. We have seen a number of requests for such a library(SoC2010, C++0x Standard Library wishlis...

boost::asio::async_read_until problem

Hi again, I'm modify the boost asio echo example to use async_read_until to read the input word by word. Even though I am using async_read_until all the data sent seems to be read from the socket. Could someone please advise: #include <cstdlib> #include <iostream> #include <boost/bind.hpp> #include <boost/asio.hpp> using boost::a...

Daylight saving time of current tz

Hi, in my c++ software I've used Boost in some parts and also for the local time. OK, now my problem is to make a check if in my machine is active or not the DST. With the follow part of code I can know only the difference from the UTC time. In my case the difference is 2 hours because is active the DST ptime tLoc = second_clock::loca...

Is there a way to have multiple "name=value" lines in the INI file using boost::program_options::parse_config_file?

I want to be able to specify multiple name=value lines in the INI file using boost::program_options. Something like [list.names] name=value name=value2 name=value3 Is there a way to achieve this with boost::program_options? I get a multiple occurrences error if I try it If not, what other libraries are available? ...