boost

Boost and Autoconf

I am making a project that uses Autoconf. I have the following in configure.ac: AC_CHECK_HEADERS([boost/foreach.hpp], [], [AC_MSG_ERROR(You need the Boost libraries.)]) When I run configure, it says it cannot find this header file: checking boost/foreach.hpp usability... no checking boost/foreach.hpp presence... no checking for b...

How to use a phoenix expression with boost::transform_iterator?

<Update> As usual for me, the question was a wrong one. The actual question is: why doesn't transform_iterator use the conventional result_of<> metafunction to determine the return type, instead of accessing UnaryFunc::result_type directly. Posted an answer with a work around. </Update> Specifically, is there a way to make a phoenix ...

looking for a MemoryStream in C++

In the wonderful world of C# i can create a memory stream without specifying its size, write into it and then just take the underlying buffer. How can i do the same in c++? basicly i need to do: memory_stream ms(GROW_AS_MUCH_AS_YOU_LIKE); ms << someLargeObjects << someSmallObjects << someObjectsWhosSizeIDontKnow; unsigned char* buff...

c++ boost compilation catastrophe

I'm writing a DLL plugin for a windows application, after adding the following includes: #include <boost/archive/text_oarchive.hpp> #include <boost/archive/text_iarchive.hpp> I get a wonderful compilation error: Error 3 error C2143: syntax error : missing ';' before '__cdecl' c:\program files (x86)\microsoft visual studio 9.0\vc\incl...

Efficient method of passing callback member function

I'm designing a method for an input handler class. Here is some pseudo code... void InputHandler::ScanEvents( boost::function1< void, std::string& > &func ) { // Scan keys, determining string to pass // If string found, call func with string as its argument on object tied to func } I'm not exactly sure how to implement this, o...

Calculating both weighted and unweighted statistics with the same boost::accumulator_set?

With Boost's accumulators I can easily calculate statistical quantities for weighted or unweighted input sets. I wonder if it is possible to mix weighted and unweighted quantities inside the same accumulator. Looking at the docs it doesn't seem that way. This compiles fine but produces another result than I would have liked: using name...

adding custom vertices to a boost graph

If I have n elements defined with class CElement, how can one create vertices of those elements with boost graph - and connect them also? I've seen boost graph bundled props, but I just can't figure this one out. ...

boost.test vs. CppUnit

I've been using CppUnit for quite a while now (and am happy with it). As we are using more and more parts of the boost library I had a short look on boost.test and I'm wondering now if I should switch to boost.test in a new project or not. Can anyone here tell me about the differences between the two frameworks and the benefits (if ther...

Boost-Python raw pointers constructors

I am trying to expose a C++ library to python using boost-python. The library actually wraps an underlying C api, so uses raw pointers a lot. // implementation of function that creates a Request object inline Request Service::createRequest(const char* operation) const { blpapi_Request_t *request; ExceptionUtil::throwOnError( ...

Difference between std::tr1::array and boost::array

I was under the impression that std::tr1::array was the same as the boost::array in that it would throw an exception when accessing an index out of bounds. In fact, I took a peek in the header and it appears that way as well. Could someone explain why the following code results in a bus error (gcc version 4.0.1 (Apple Inc. build 5465)) ...

What does boost::thread do if it fails to create the thread?

What does boost::thread do if it fails to create the thread? The winAPI returns a NULL (I guess posix does something similar) but as thread is an object how do I test to see if the thread was created? ...

Solr: fieldNorm different per document, with no document boost

I want my search results to order by score, which they are doing, but the score is being calculated improperly. This is to say, not necessarily improperly, but differently than expected and I'm not sure why. My goal is to remove whatever is changing the score. If I perform a search that matches on two objects (where ObjectA is expecte...

Boost::Interprocess Shared Memory Bus Error

Hi, I'm using CentOS 5.4 x86_64 and Boost 1.42.0 on a cluster that uses Open-MPI 1.3.3. I'm writing a shared library that uses shared memory to store large amounts of data for multiple processes to use. There's also a loader application that will read in the data from the files and load them into the shared memory. When I run the l...

Is there a way to Boost.Assign a ptr_vector?

Usually like this: #include <boost/assign/std/vector.hpp> vector<int> v; v += 1,2,3,4,5; Except for a: #include <boost/ptr_container/ptr_vector.hpp> boost::ptr_vector<int> v; If you need to know the reason; I'm using ptr_vector instead of vector only so I don't have to delete elements, but I need to initialize it using Boost.Assign...

Boost Asio On Linux Not Using Epoll

I was under the impression that boost::asio would use an epoll setup by default instead of a select implementation, but after running some tests it looks like my setup is using select. OS: RHEL 4 Kernel:2.6 GCC:3.4.6 I wrote a little test program to verify which reactor header was being used, and it looks like its using the select reac...

boost::ptr_vector and find_if

I have a class: //header file class CMDatabase { class Try; typedef boost::shared_ptr<Try> TryPtr; typedef boost::ptr_vector<Try> TryVector; typedef TryVector::iterator TryVectorIterator; class Try { public: virtual ~Try(); virtual bool equal(CMDatabase::TryPtr mySd) = 0; }; }...

Where is disable_if in C++0x?

Boost has both enable_if and disable_if, but C++0x seems to be missing the latter. Why was it left out? Are there meta-programming facilities in C++0x that allow me to build disable_if in terms of enable_if? Oh, I just noticed that std::enable_if is basically boost::enable_if_c, and that there is no such thing as boost::enable_if in C...

trying to see if vector<string> has no values in map<string, string>

Hi Guys, Just for fun I was trying to write a one line with std::find_if with boost::bind to check whether all the keys given in a vector in a map has no values, but really could not come up with a neat line of code. Here is what I attempted vector<string> v; v.push_back("a"); v.push_back("2"); ... map<string, string> m; m....

How to build Boost::program_options

I wanted to use boost::program_options. After I installed boost, I think that I have to build separatly program_options (http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html). But I don't know how to do it. I am trying to compile the C:\Program Files\boost\boost_1_42\libs\program_options\example\first.cpp (http://www.b...

Boost C++ regex - how to get multiple matches

If I have a simple regex pattern like "ab." and I have a string that has multiple matches like "abc abd". If I do the following... boost::match_flag_type flags = boost::match_default; boost::cmatch mcMatch; boost::regex_search("abc abd", mcMatch, "ab.", flags) Then mcMatch contains just the first "abc" result. How can I get all ...