boost

how to install boost to the VS 2008?

I`ve almost completely install Boost but I have a problem which is how to set path to Boost in Tools->options->projects->VC++ Directories. I`ve written the path to include files and libraries (my folder contains of two subfolders which is 'lib' and 'include'), but when I try to use Boost include boost/regex.hpp> I got this linking err...

"Functionoids"?

I've read the description of "functionoids" here. They look like a poor-man's version of Boost::function and Boost::bind. Am I missing something? Is there a good reason to use them if you're already using Boost? ...

Why do Boost libraries return things "convertible to `bool`" rather than just returning `bool`s?

Several times, while perusing the Boost library's documentation, I've run across return values that are marked "convertible to bool" (search that page for the phrase "convertible to bool", it's about a third of the way down). I once stumbled across an oblique reference to a paper explaining the reason for that, but have never been able t...

Evaluating expressions inside C++ strings: "Hi ${user} from ${host}"

I'm looking for a clean C++ way to parse a string containing expressions wrapped in ${} and build a result string from the programmatically evaluated expressions. Example: "Hi ${user} from ${host}" will be evaluated to "Hi foo from bar" if I implement the program to let "user" evaluate to "foo", etc. The current approach I'm thinking ...

Really Strange Problem about access violation

I've met a really strange problem: The code is as follow: ::boost::shared_ptr<CQImageFileInfo> pInfo=CQUserViewDataManager::GetInstance()->GetImageFileInfo(nIndex); Image* pImage=pInfo->m_pThumbnail; if(pImage==NULL) pImage=m_pStretchedDefaultThumbImage; else { // int sourceWidth = pInfo->GetWidth(); int sourceHeight = pInfo->GetH...

Boost Asio serial_port - need help with io

So I've been trying to learn the boost::asio stuff to communicate to a serial device using RS232. The documementation is sparse and the examples are non-existent. Can't figure out exactly how to communicate with the device. The device can't send data so all I need to do is write, but other projects require actual back and forth commun...

Testing for assert in the Boost Test framework

I use the Boost Test framework to unit test my C++ code and wondered if it is possible to test if a function will assert? Yes, sounds a bit strange but bear with me! Many of my functions check the input parameters upon entry, asserting if they are invalid, and it would be useful to test for this. For example: void MyFunction(int para...

Performance implications of &p[0] vs. p.get() in boost::scoped_array

The topic generically says it all. Basically in a situation like this: boost::scoped_array<int> p(new int[10]); Is there any appreciable difference in performance between doing: &p[0] and p.get()? I ask because I prefer the first one, it has a more natural pointer like syntax. In fact, it makes it so you could replace p with a native...

Parallel quicksort: recursion using Boost Bind?

I am working on making quicksort parallel, threads being the first attempt. The non threaded version sorts correctly but the threaded doesn't (no surprise there). What I found interesting was when I removed the threads but kept the boost::bind calls it still doesn't work. If boost::bind isn't what I want please offer a suggestion. Bi...

Exposing a C++ API to Python

I'm currently working on a project were I had to wrap the C++ classes with Python to be able to script the program. So my specific experience also involved embedding the Python interpreter in our program. The alternatives I tried were: Boost.Python I liked the cleaner API produced by Boost.Python, but the fact that it would have requ...

Why can't I store boost::function in std::list?

Why does the following code have the error "error: expected `;' before 'it'"? #include <boost/function.hpp> #include <list> template< class T > void example() { std::list< boost::function<T ()> >::iterator it; } ...

demote boost::function to a plain function pointer

want to pass boost::bind to a method expecting a plain function pointer (same signature). typedef void TriggerProc_type(Variable*,void*); void InitVariable(TriggerProc_type *proc); boost::function<void (Variable*, void*)> triggerProc ... InitVariable(triggerProc); error C2664: 'InitVariable' : cannot convert parameter 1 from 'boost::f...

Reversed offset tokenizer

I have a string to tokenize. It's form is HHmmssff where H, m, s, f are digits. It's supposed to be tokenized into four 2-digit numbers, but I need it to also accept short-hand forms, like sff so it interprets it as 00000sff. I wanted to use boost::tokenizer's offset_separator but it seems to work only with positive offsets and I'd lik...

Boost 1.37

I can't find a pre-built set of MSVC++ libs for Boost 1.37.0 (latest stable version), only the source. I don't understand how their weird build system works... are there any places I can find a download of a visual studio project or something? ...

How to set a timeout on blocking sockets in boost asio?

Is there a way to cancel a pending operation (without disconnect) or set a timeout for the boost library functions? I.e. I want to set a timeout on blocking socket in boost asio? socket.read_some(boost::asio::buffer(pData, maxSize), error_); Example: I want to read some from the socket, but I want to throw an error if 10 seconds have ...

can you set SO_RCVTIMEO and SO_SNDTIMEO socket options in boost asio?

can you set SO_RCVTIMEO and SO_SNDTIMEO socket options in boost asio? If so how? Note I know you can use timers instead, but I'd like to know about these socket options in particular. ...

Does delete work with pointers to base class?

Do you have to pass delete the same pointer that was returned by new, or can you pass it a pointer to one of the classes base types? For example: class Base { public: virtual ~Base(); ... }; class IFoo { public: virtual ~IFoo() {} virtual void DoSomething() = 0; }; class Bar : public Base, public IFoo { public: vi...

Wrapping boost::signal to C# delegates

Hi, say I have an asynchronous library, written in native C++, with an interface similar to this: class connection { public: boost::signal< void() > sig_connection_made; boost::signal< void(const std::string&) > sig_error; void connect(const std::string& host, const std::string& port); }; that I want to wrap in C#. Does ...

How to debug code that uses boost w/o losing sanity?

Boost is a great set of libraries and it really boosts productivity. But debugging code that uses it is a total nightmare. Sure, stepping through twenty thousand header files can be a valuable intellectual exercise, but what if you need to do it over and over again? Is there a developer-friendly way of just skipping the boost portion an...

How do you build the x64 Boost libraries on Windows?

I've built the x86 Boost libraries many times, but I can't seem to build x64 libraries. I start the "Visual Studio 2005 x64 Cross Tools Command Prompt" and run my usual build: bjam --toolset=msvc --build-type=complete --build-dir=c:\build install But it still produces x86 .lib files (I verified this with dumpbin /headers). What am I d...