boost

Is using macros to abbreviate long winded boost template names a bad practice?

I am tired of writing shared_ptr<>, it's lengthening the code lines tremendously. Any reason not to do this? ...

getting names subgroups

Hi All I am working with the new version of boost 1.42 and I want to use regex with named sub groups. Below an example. std::string line("match this here FIELD=VALUE in the middle"); boost::regex rgx("FIELD=(?<VAL>\\w+)", boost::regex::perl ); boost::smatch thisMatch; boost::regex_search( line, thisMatch, rgx ); Do you know how to g...

shared_ptr requires complete type; cannot use it with lua_State*

Hello! I'm writing a C++/OOP wrapper for Lua. My code is: class LuaState { boost::shared_ptr<lua_State> L; LuaState(): L( luaL_newstate(), LuaState::CustomDeleter ) { } } The problem is lua_State is incomplete type and shared_ptr constructor requires complete type. And I need safe pointer sharing. (Funny thing bo...

resolving overloads in boost.python

I have a C++ class like this: class ConnectionBase { public: ConnectionBase(); template <class T> Publish(const T&); private: virtual void OnEvent(const Overload_a&) {} virtual void OnEvent(const Overload_b&) {} }; My templates & overloads are a known fixed set of types at compile time. The application code derives f...

When does an asio timer go out of scope?

What I mean is, let's say you do an async_wait on an asio timer and bind the update to a function that takes a reference to a type T. Let's say you created the T initially on the stack before passing it to async_wait. At the end of that async_wait, it calls async_wait itself, renewing the timer over and over. Does that stack allocated ty...

Boost .lib's for Visual Studio 2010

Where can i get boost .lib for visual studio 2010?? I tried to rename the old .lib's for VS2008 but this didn't work for the threads library. ...

VC9 C1083 Cannot open include file: 'boost...' after trying to abstract an include dependency

Hey, So I've been working on a project for the past number of weeks and it uses a number of Boost libraries. In particular I'm using the boost::dynamic_bitset library quite extensively. I've had zero issues up until now; but tonight I discovered a dependency between some includes which I had to resolve; and I tried to do so by providin...

Has the small object allocator found in "Modern C++ Design"/Loki been deprecated in favor of newer implementations?

It seems the code and the book have been relegated to the foundation of the movement of modern C++, and isn't updated any more. Is there some kind of replacement for this in Boost or TR1? ...

Boost PropertyTree library with C++Builder?

Has anyone got tried this or got it working with Embarcadero C++Builder 2010 - If so, what did you need to do? ...

Boost.MultiIndex: How to make an effective set intersection?

Hello, assume that we have a data1 and data2. How can I intersect them with std::set_intersect()? struct pID { int ID; unsigned int IDf;// postition in the file pID(int id,const unsigned int idf):ID(id),IDf(idf){} bool operator<(const pID& p)const { return ID<p.ID;} }; struct ID{}; struct IDf{}; typedef mul...

How to iterate on boost::mutable_queue

Hello, I need a priority queue where I can increase or decrease the priority key. So boost::mutable_queue seemed perfect despite the lack of documentation. The problem is that I need to iterate at some point over all the elements in the queue. How can I do that? Or is there an othe data structure that would work (preferably in boost)?...

Getting a shared pointer to a derived class when base class inherits from enable_shared_from_this

I have a class B which inherits from A which in turn derives from enabled_shared_from_this. Now, I want to get a shared pointer to B from an instance of B. shared_from_this will return shared_ptr<A>, not shared_ptr<B>. Should I use boost::static_pointer_cast here? Or is there a better way? ...

using the boost::scoped_lock(Mutex &mx, bool initially_locked) constructor gives me errors.

Isn't there a boost::scoped_lock constructor that takes a boolean as the second parameter? I thought I had used it before. boost::scoped_lock(Mutex &mx, bool initially_locked) The documentation for scoped_lock shows the second parameters as "unspecified". Anyone know what in the @(*$ that is suppose to mean?!? the errors I get are: ...

Turn off the warnings due to boost library

Hello All, I am building an application in C++, Mac OS X, Qt and using boost libraries. Every time i build a project I get a huge list of warnings only from boost libraries itself. I want to turn off them so that I can see only my project specific warnings and errors. Can anybody help me? Thanks, Rahul ...

How can i hold reference in boost::shared_ptr using boost::bind without definition of explicit function?

I want to hold reference to object so it doesn't get deleted in bind function, but without using helper function. struct Int { int *_int; ~Int(){ delete _int; } }; void holdReference(boost::shared_ptr<Int>, int*) {} // helper boost::shared_ptr<int> fun() { boost::shared_ptr<Int> a ( new Int ); // I get 'a' from some pleas...

Unable to capture standard output of process using Boost.Process

Currently am using Boost.Process from the Boost sandbox, and am having issues getting it to capture my standard output properly; wondering if someone can give me a second pair of eyeballs into what I might be doing wrong. I'm trying to take thumbnails out of RAW camera images using DCRAW (latest version), and capture them for conversi...

Boost link error when using "--layout=system" on VS2005

I'm new to boost, and thought I'd try it out with some realistic deployment scenarios for the .dlls, so I used the following command to compile/install the libraries: .\bjam install --layout=system variant=debug runtime-link=shared link=shared --with-date_time --with-thread --with-regex --with-filesystem --includedir=<my include directo...

"Could not deduce template argument" error when using Winsock bind() call with Boost

I'm fairly new to C++, and I'm likely in over my head, but that's the way it goes. I'm working with a fairly large Win32 C++ project that uses Winsock for its network communications. I'm in the process of trying to convert a bunch of its thread management over to boost, but once I added the references to the boost libraries and what-no...

Template with constant expression: error C2975 with VC++2008

Hello, I am trying to use elements of meta programming, but hit the wall with the first trial. I would like to have a comparator structure which can be used as following: intersect_by<ID>(L1.data, L2.data, "By ID: "); intersect_by<IDf>(L1.data, L2.data, "By IDf: "); Where: struct ID{};// Tag used for original IDs struct IDf{};/...

Safe way for getting/finding a vertex in a graph with custom properties -> good programming practice?

Hi, I am writing a Graph-class using boost-graph-library. I use custom vertex and edge properties and a map to store/find the vertices/edges for a given property. I'm satisfied with how it works, so far. However, I have a small problem, where I'm not sure how to solve it "nicely". The class provides a method Vertex getVertex(Vertexprop...