boost

How can I access my class instance from a boost thread?

I have the following code (this is some semi-sudo code, which may not compile): class FooBar { public: void a(); void b(); boost::shared_ptr<boost::thread> m_thread; std::string m_test; }; void FooBar::a() { m_test = "Foo bar" m_thread = shared_ptr<thread>(new thread(bind(&FooBar::b, this))); } void FooBar::b()...

How can I use a custom type for keys in a boost::unordered_map?

I'm using Boost's implementation of a hash map in a project right now, and I'm trying to implement a custom type for keys. I have four unsigned integers which I'd like to combine into a single 128-bit datatype to use as a key. I've created a struct with a 32-bit integer array of four elements, which serves as my storage. To be honest, I...

boost::any test code compiles with Sun CC but not g++

The following noddy test code: #include <iostream> #include <list> #include <boost/any.hpp> #include <boost/foreach.hpp> #include <typeinfo.h> using boost::any_cast; using std::cout; using std::cerr; typedef std::list<boost::any> many; template <typename T> inline bool is_any(const boost::any& op) { return (op.type() == typeid(T)); ...

Detach a pointer from a shared_ptr?

A function of my interface returns a pointer to an object. The user is supposed to take ownership of that object. I do not want to return a Boost.shared_ptr, because I do not want to force clients to use boost. Internally however, I would like to store the pointer in a shared_ptr to prevent memory leaks in case of exceptions etc. There s...

A good example for boost::algorithm::join

I recently wanted to use boost::algorithm::join but I couldn't find any usage examples and I didn't want to invest a lot of time learning the Boost Range library just to use this one function. Can anyone provide a good example of how to use join on a container of strings? Thanks. ...

Boost: MacOSX binaries for Boost

Are there any MacOSX universal binaries (at least i386/ppc for >=macosx10.3) for Boost? ...

Boost: how to build Boost under MacOSX

I am trying to build MacOSX universal binaries (I need at least i386/ppc for >=macosx10.3) of Boost. I tried a lot of different methods and options and versions and it all fails in the end with this crash: http://stackoverflow.com/questions/1823605/boost-what-could-be-the-reasons-for-a-crash-in-boostslotslot I guess this crash is beca...

Which version of boost should I use with c++ visual-studio-2005?

Does anyone know what version of the Boost Library to use with Visual Studio 2005? ...

Is it possible to use separate threads for reading and writing with Boost.Asio?

According to the Boost Documentation, having multiple threads call io_service::run() sets up a pool of threads that the IO service can use for performing asynchronous tasks. It explicitly states that all threads that have joined the pool are considered equivalent. Does this imply that it is not possible to have a separate thread for rea...

what's the difference between Boost.MPI and Boost.Interprocess?

I suppose they are different, right? From a performance perspective, which is faster? Has anyone ever did some benchmarking ? Can I use them to pass data within the same process ? (i.e., among different threads) thanks! ...

Unziping a zip file with boost and Visual C++ 2005?

Is there a library in boost that can be used to unzip a zip file? ...

Loading Boost 1.40.0 into Intellisense in Visual Studio 2005?

Is there any way to get Intellisense in Visual C++ for Visual Studio 2005? I'm trying to get the Boost libraries to load up with intellisense and in the object browser/class view. I installed the binary for Windows with the BoostPro installer (BoostPro 1.40.0 Installer). I'm not certain that it comes with the source code however, whic...

map of boost pools?

Basically im giving a very weak shot at trying to centralize memory management. Anyways, boost::pool uses chunks of certain sizes. My orignal idea, was to overload new and delete, pass the size into a singleton which would go to the corresponding boost pool and alloc from there. std::map<size_t, boost::pool<> > m_MemPools; Anyways it...

boost::random generate the same number every time

main .cpp #include "stdafx.h" #include "random_generator.h" int main ( int argc, char *argv[] ) { cout.setf(ios::fixed); base_generator_type base_generator; int max = pow(10, 2); distribution_type dist(1, max); boost::variate_generator<base_generator_type&, distribution_ty...

Cross-platform library for manipulating Windows paths?

I am writing a cross-platform application that needs to inspect and manipulate Windows-paths. Specifically, for the particular problem I am having now, I need to know if a path is absolute or relative. The current code uses boost::filesystem::path which of course works like a charm on Windows: boost::filesystem::path the_path(the_path...

Cast boost::shared_array<char> to boost::shared_array<const char>

How can I cast a boost::shared_array<char> to boost::shared_array<const char>? ...

Get the templated type as a string

After reading C++ compile-time string hashing with Boost.MPL, and considering a problem I have, the following came to my mind. I have the base class: template<class Command> class Base { typedef Command CommandType; } It is supposed to be a utility base class for the Commands classes, so they don't need to typedef and declare some ...

Why is there so much legal paranoia surrounding Boost?

It seems from reading SO that there's a lot of legal concern about Boost in some companies. Some people are apparently prohibited from using it. Since Boost is licensed under about the most permissive license you could possibly think of, where does this concern stem from. Edit: People have asked for specific posts. I don't remember ...

Boost's Interpreter.hpp example with class member functions

Boost comes with an example file in boost_1_41_0\libs\function_types\example called interpreter.hpp and interpreter_example.hpp I am trying to create a situation where I have a bunch of functions of different arguments, return types, etc all register and be recorded to a single location. Then have the ability to pull out a funct...

Disable Exceptions in BOOST?

I want to use boost::asio but I don't want boost to throw exceptions, because in my environment exceptions must not be raised. I've encountered BOOST_NO_EXCEPTIONS but the documentation says that callers of throw_exception can assume that this function never returns. But how can a user supplied function not return? What replacement fun...