boost

Nested quantifiers in boost::regex

Is \d++ a valid regular expression in programming languages that don't support possessive quantifier?Is it equivalent to (\d+)+? When testing it in Python,an error sre_constants.error: multiple repeat will be raised.In C#,it will throw a runtime exception:System.ArgumentException: parsing "\d++" - Nested quantifier +.As well as boost:...

Variables addresses

Hello, I'm writing statistic system. It should make some output with given params. For example: float getSunActivity() { ... } int getEarthActivity() { ... } StatisticSystem::track("sun_activity", boost::any(getSunActivity())); StatisticSystem::track("earth_activity", boost::any(getEarthActivity())); class StatisticSystem { typedef...

How to merge a large set of polygons with Boost Polygon?

I am looking for a way, using Boost Polygon, to read in a large set of polygons from a file, and output the resulting merge or union to a result file. In this case the polygons touch but do not overlap. I can put the data in any format. Not sure if there is a standard used by Boost Polygon. I am also looking for more documentation on the...

How to detect whether there is anything left inside a boost archive

Is there a way to detect whether there is anything left inside a boost archive after I read from it? I tried this piece of code: const string s1("some text"); std::stringstream stream; boost::archive::polymorphic_text_oarchive oAr(stream); oAr << s1; boost::archive::polymorphic_text_iarchive iAr(stream); string s2; iAr >> s2; if (!str...

Cannot compile with memory dump for some files

Hi, I use this Debug.h file that I include as the last #include of the files where I want to debug for memory leaks. Then using _CrtDumpMemoryLeaks(); to dump it to my output.. This works fine for most files, but when I include it in some files I get the error below. It looks like it got to do with the boost::unorderer_map<> .. but I ca...

Instantaneous interruption of a Boost::thread

I'm trying to implement a program which runs a function limited by a fixed amount of time. I've managed to do it with pthreads but I would like to use Boost::thread. So far I've coded the following: #include <boost/thread.hpp> #include <unistd.h> #include <signal.h> #include <iostream> using namespace std; boost::thread mythread; vo...

How to use Boost.Interprocess to stream data to other applications ?

The main application needs to update the shared memory at a fast frequency. And several consuming applications need to read from the shared memory to update the streamed data. main and consuming applications are different processes. How to implement this with Boost.Interprocess ? ...

replace whitespace in an string c++ boost problem

hello i am using this code to replace the while space but it never replaces all the white space can u please tell me where i am wrong #include <iostream> #include <string> #include <boost/regex.hpp> #include<boost/algorithm/string.hpp> #include<boost/algorithm/string/replace.hpp> using namespace std; int main(void) { string...

Building a Python extension with bjam (Boost.Build) on Mac OS X

So far as I can tell what happens is this: In python.jam, it works out which version of Python I am using and which library directories to look in; It adds -Wl-R arguments to the g++ command line to include those directories; The ld command complains that it does not have a -R option. So either (a) I have a defective version of ld, o...

How to use Boost uBLAS C++ library in an iPhone project?

I want to use Boost library in my iPhone project, specifically only boost::numeric::ublas. I managed to build static libraries for boost in order to link them in my iPhone project. However, when I look at those .a libraries I can't find one that's related to ublas (I tried ./bootstrap.sh --with-libraries=ublas in terminal but no luck). D...

Building an unordered map with tuples as keys

In a C++ program with Boost, I am trying to build an unordered map whose keys are tuples of doubles: typedef boost::tuples::tuple<double, double, double, double> Edge; typedef boost::unordered_map< Edge, int > EdgeMap; Initializing the map completes OK, however, when I try to populate it with keys and values EdgeMap map; Edge key (0...

visitor template for boost::variant

Hi, I would like to use a boost.variant<T0,T1,T2> as a parameter to a template 'Visitor' class which would provide visitor operators as required by the boost.variant visitor mechanism, in this case all returning void i.e., void operator()(T0 value); void operator()(T1 value); void operator()(T2 value); The template would also have fo...

Multi-index container for ruby

Is there anything like boost::multi_index but for ruby. Basically taking some container of objects and having it indexed N different ways with N different query methods. I guess you could use DataMapper with the SQLite in memory database but I was wondering if there is anything pure ruby around. Below is an imagined example of what thi...

Boost mmap performance vs native memory maps.

I will be writing a benchmarking tool that will test a mix of IOPS and bandwidth of a disk system and as such I will be turning to file backed memory maps for IO. Because the tool is going to need to be on both POSIX and WinNT platforms I can't just use plain old mmaps. Also from what I understand you have to madvise the Linux kernel tha...

boost::weak_ptr interaction with custom deleter

I have a boost::shared_ptr with a custom deleter attached. When converting this to weak_ptr is the deleter information lost? If yes, how do I reattach the same deleter to shared_ptr-s acquired from weak_ptr::lock() method? The feature I am implementing is a container of weak_ptr-s pointing to the alive instances of some type. I need th...

How to execute test suites based on requirement in boost.test library

Hello, I am using Boost.Test library for implementing unit test cases in C++. Suppose I have two suites such as BOOST_AUTO_TEST_SUITE(TestA) BOOST_AUTO_TEST_CASE(CorrectAddition) { BOOST_CHECK_EQUAL(2+2, 4); } BOOST_AUTO_TEST_CASE(WrongAddition) { BOOST_CHECK_EQUAL(2 + 2, 5); } BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE...

What's the point of boost::multi_index_container::index<Tag>::type ?

If you have a boost::multi_index_container< > with multiple indices, there are obviously multiple ways to iterate over it - each index defines a way. For instance, if you have an index with tag T, you can iterate from container.get<T>().begin() to container.get<T>().end(). If you try to do so in a for-loop (and do not have C++0x auto),...

Check if a class has a method

Possible Duplicate: Possible for C++ template to check for a function's existence? Do you know of any metaprogramming tricks in C++ that allow me to check whether a class has a specific method. I has been thinking about something like this: template <class T, class Enable = void> class A { ... }; // This version of the clas...

Short options only in boost::program_options

How would one go about specifying short options without their long counterparts in boost? (",w", po::value<int>(), "Perfrom write with N frames") generates this -w [ -- ] arg : Perfrom write with N frames Any way to specify short options only? ...

enable_if on overloaded operator with different return type

I am trying to basically do 3 things at once here: overload the assignment operator using a template, restrict the types (using boost::enable_if), and having a specific return type. Take this as an example: template <class T> std::string operator =(T t) { return "some string"; } Now, according to boost enable_if (sec 3, bullet pt 1)...