boost

Why do thread functions need to be declared as '__cdecl'?

Sample code that shows how to create threads using MFC declares the thread function as both static and __cdecl. Why is the latter required? Boost threads don't bother with this convention, so is it just an anachronism? For example (MFC): static __cdecl UINT MyFunc(LPVOID pParam) { ... } CWinThread* pThread = AfxBeginThread(MyFunc, ....

How do you deal with large dependencies in Boost?

Boost is a very large library with many inter-dependencies -- which also takes a long time to compile (which for me slows down our CruiseControl response time). The only parts of boost I use are boost::regex and boost::format. Is there an easy way to extract only the parts of boost necessary for a particular boost sub-library to make c...

How to filter items from a std::map?

I have roughly the following code. Could this be made nicer or more efficient? Perhaps using std::remove_if? Can you remove items from the map while traversing it? Can we avoid using the temporary map? typedef std::map<Action, What> Actions; static Actions _actions; bool expired(const Actions::value_type &action) { return <something>...

How to make Visual Studio Pause after executing a console app in debug mode?

I have a collection of boost unit tests I want to run as a console application. When I'm working on the project and I run the tests I would like to be able to debug the tests and I would like to have the console stay open after the tests run. I see that if I run in release mode the console window stays up after the program exits, but i...

Which is better BOOST_MPL_ASSERT or BOOST_STATIC_ASSERT?

As I recall BOOST_MPL_ASSERT was once preferred. Is this still true? Anyone know why? ...

How is tr1::reference_wrapper useful?

Hi, recently I've been reading through Scott Meyers's excellent Effective C++ book. In one of the last tips he covered some of the features from TR1 - I knew many of them via Boost. However, there was one that I definitely did NOT recognize: tr1::reference_wrapper. How and when would I use tr1::reference_wrapper? ...

What is a good use case for tr1::result_of?

I hear that tr1::result_of gets used frequently inside of Boost... I'm wondering if there are any good (simple) use cases for tr1::result_of I can use at home. ...

Boost like libraries in C

Hi, Can you recommend peer reviewed libraries that I can use in C environment (something like Boost for C++) ? Something that provides hash, thread, interprocess communications, lists, smart memory management... The environment is embedded system, not a very minimal system, but also not a PC! Thanks! Amit ...

Better to return a C++ reference or a weak_ptr?

Suppose I have a class where I want the user to be able to have a reference to one of my members. Which is preferred? class Member; class ClassWithWeakPtr { private: boost::shared_ptr<Member> _member; public: boost::weak_ptr<Member> GetMember(); }; or class Member; class ClassWithCppReference { private: Member _member; pu...

Is there a .net analogue to the Boost libraries?

As per the title. I think .Net libraries would definitely benifit from some sort of community development; perhaps something like the Java Community Process. This is where an analogue would be very helpful. EDIT: I think people are believing that I need to use some libraries. That's not what I'm talking about. I mean something like a f...

When will boost 1.36 be available for Mac Port?

How can i find out this information? Ie, I can install boost 1.35 with a command like sudo port install boost only to get boost 1.36 via port i would do something like this? sudo port install boost-1.36 Hope that clears up my question ...

Adding Boost makes Debug build depend on "non-D" MSVC runtime DLLs

I have an annoying problem which I might be able to somehow circumvent, but on the other hand would much rather be on top of it and understand what exactly is going on, since it looks like this stuff is really here to stay. Here's the story: I have a simple OpenGL app which works fine: never a major problem in compiling, linking, or run...

C++ template instantiation of function template parameters

Hi, I have the following problem using template instantiation [*]. file foo.h class Foo { public: template <typename F> void func(F f) private: int member_; }; file foo.cc template <typename F> Foo::func(F f) { f(member_); } file caller.cc Foo::func(boost::bind(&Bar::bar_func, bar_instance, _1)); While this c...

Good books on QT and Boost libraries

Hi everyone, I'd like you to recommend some fine books on Boost and QT libraries. I've been learning C++ for more than a year, I've learned the syntax and language basics, it's gotchas, a few development features and gotcha's. I don't have big experience in development. Read Eckel (Thinking in C++), Meyers. ...

How do I sort a std::vector by the values of a different std::vector?

I have several std::vector, all of the same length. I want to sort one of these vectors, and apply the same transformation to all of the other vectors. Is there a neat way of doing this? (preferably using the STL or Boost)? Some of the vectors hold ints and some of them std::strings. Pseudo code: std::vector<int> Index = { 3, 1, 2 ...

Boost C++ libraries for gcc-arm toolchain

I have no trouble building 1.35.0, as well as 1.36.0 on the timesys arm-gcc toolchain, both statically (link-static) as well as dynamically (.so, default option). However, when I try to link a simple sample filesystem app: #include <boost/filesystem.hpp> #include <iostream> namespace fs = boost::filesystem; int main(int argc, char *a...

Best documentation for Boost:asio ?

The documentation available on the boost website is... limited. From what I've been able to read, the general consensus is that it is simply difficult to find good documentation on the boost::asio library. Is this really the case? If so, why? Notes: I have already found the (non-boost) Asio website - and the documentation looks to ...

YAML serialization library for C++?

YAML seems like a great format for configuration files & data binding persistent objects in human-readable form... Is there a C++ library that handles YAML? Does Boost::Serialization have plans for a YAML option? EDIT: I would prefer an OO library. ...

how do you make a heterogeneous boost::map?

I want to have a map that has a homogeneous key type but heterogeneous data types. I want to be able to do something like (pseudo-code): boost::map<std::string, magic_goes_here> m; m.add<int>("a", 2); m.add<std::string>("b", "black sheep"); int i = m.get<int>("a"); int j = m.get<int>("b"); // error! I could have a pointer to a base ...

What's the latest version of Boost compatible with VC++6?

What is the latest version of the Boost library that is compatible with Microsoft Visual C++ 6? And can you provide a link to download it directly? The Downloads link at http://www.boost.org only gives a download for version 1.36.0, and the documentation for that version lists Visual C++ 7.1 as the lowest version of Microsoft compiler ...