boost

Immutable classes in C++

Hi, In one of my projects, I have some classes that represent entities that cannot change once created, aka. immutable classes. Example : A class RSAKey that represent a RSA key which only has const methods. There is no point changing the existing instance: if you need another one, you just create one. My objects sometimes are heavy a...

boost::dynamic_pointer_cast with const pointer not working ?

Hi, Let's say I have two classes, A and B, where B is a child class of A. I also have the following function: void foo(boost::shared_ptr<const A> a) { boost::shared_ptr<const B> b = boost::dynamic_pointer_cast<const B>(a); // Error ! } Compilation with gcc gives me the following errors: C:\Boost\include/boost/smart_ptr/shared_p...

C++: Binding to a base class

EDIT: In the following code container::push takes an object of type T that derives from base as argument and stores in a vector a pointer to the method bool T::test(). container::call calls each of the stored methods in the context of to the member object p, which has type base, not T. It works as long as the called method does not ref...

Problem porting boost 1.33.1 programm to boost 1.42.0

i've got a variable: boost::program_options::options_description m_corbaDesc; and the following is done with it m_corbaDesc.add_options() ("corba", boost::programm_options::parameter("<options+>", &m_corbaOptions), "CORBA -ORBInitRef options") ("corba-ns", boost::program_options::parameter("<name:port>", &m_corbaNameService),...

Erasing and modifying elements in Boost MultiIndex Container

I'm trying to use a Boost MultiIndex container in my simulation. My knowledge of C++ syntax is very weak, and I'm concerned I'm not properly removing an element from the container or deleting it from memory. I also need to modify elements, and I was hoping to confirm the syntax and basic philosophy here too. // main.cpp ... #include <bo...

Released object crashes app

I am using objective-C++ (+Boost) for iPhone development. I am in a rather tight loop and need to allocate and release a certain object. The code is something like this. for (int i=0;i<100;i++) { opt = [[FObj alloc] init]; //do stuff with opt [opt release]; } The FObj object is something like @interface FObj MyCPPObj ...

boost thread, test if thread is ready to join

hi. I would like to know if there is a way to test whenever thread finished execution and is waiting for joining. My guess was the use time_join. is there explicit way to test it? ...

Libtool versioning of a library that depends on other libraries.

Hello, I have a framework that uses Boost and CgiCC in the core application and in its interface. How should I version the library binary interface (a.k.a. libtool -version-info)? I have no problems tracking the changes in library itself when I make various changes. As it is clear for me how should I version. But... Both Boost and C...

C++ boost thread reusing threads

hi. I am trying to accomplish something like this: thread t; // create/initialize thread t.launch(); // launch thread. t.wait(); // wait t.launch(); // relaunch the same thread How to go about implementing something like this using boost threads? in essence, I need persistent relaunch-able thread. I would like to avoid work queue, a...

Formatting time in milliseconds using boost::date_time library

I have a time duration in milliseconds which I ideally would like to format using the formatting functionality present in the boost::date_time library. However, after creating a boost::posix_time::time_duration I can't seem to find a way to actually apply the formatting string to it. ...

C++ boost thread id and Singleton

hi. Sorry to flood so many questions this week. I assume thread index returned by thread.get_id is implementation specific. In case of the pthreads, is index reused? IE, if thread 0 runs and joins, is thread launched afterwords going to have a different ID? the reason I ask this is a need to implement Singleton pattern with a twist: ...

Is there any good book for Boost library C++ and for Object Oriented Design in C++?

This post is about 2 questions in one: Good books for Boost C++ library OO Design in C++. I come from Java background and tend to think in terms of Interfaces, Singletons etc. How do I translate it to C++ or how to start thinking differently for C++ -Ajay ...

typedef declaration syntax

Some days ago I looked at boost sources and found interesting typedef. There is a code from "boost\detail\none_t.hpp": namespace boost { namespace detail { struct none_helper{}; typedef int none_helper::*none_t ; } // namespace detail } // namespace boost I didn't see syntax like that earlier and can't explain the sense of that....

Composite key syntax in Boost MultiIndex

...

Apples new section 3.3.1

With Apple making changes to section 3.3.1 on the iPhone dev agreement can one stillness libraries like boost in their apps? I want to use Boost in my iPad app... ...

debug boost::thread with gdb, code::blocks

I am running in a little bit of a trouble with boost threads ... I am using gdb with code::blocks and everytime I set a breakpoint in the thread code it breaks in the boost thread.hpp file, more exactly in this function (that probably launches the thread) namespace boost namespace detail class thread_data: void r...

Boost::Container::Vector with Enum Template Argument - Not Legal Base Class

Hi, I'm using Visual Studio 2008 with the Boost v1.42.0 library. If I use an enum as the template argument, I get a compile error when adding a value using push_back(). The compiler error is: 'T': is not a legal base class and the location of the error is move.hpp line 79. #include <boost/interprocess/containers/vector.hpp> class Te...

visual studio 2005 to 2010 with boost

About a month a go I spent almost an entire week trying to figure out how to build the boost libraries for vs2005 and today I updated to vs2010. Do I need to remove boost for vs 2005(I uninstalled vs2005) and go through the build process for 2010 or will it magically work and I can go take a nap? ...

boost::shared_ptr in Objective-C++

This is a better understanding of a question I had earlier. I have the following Objective-C++ object @interface OCPP { MyCppobj * cppobj; } @end @implementation OCPP -(OCPP *) init { cppobj = new MyCppobj; } @end Then I create a completely differently obj which needs to use cppobj in a boost::shared_ptr (I have no choic...

How to pass user-defined structs using boost mpi

I am trying to send a user-defined structure named ABC using boost::mpi::send () call. The given struct contains a vector "data" whose size is determined at runtime. Objects of struct ABC are sent by master to slaves. But the slaves need to know the size of vector "data" so that the sufficient buffer is available on the slave to receive...