boost

Crossplatform building Boost with SCons

I tried hard but couldn't find an example of using SCons (or any build system for that matter) to build on both gcc and mvc++ with boost libraries. Currently my SConstruct looks like env = Environment() env.Object(Glob('*.cpp')) env.Program(target='test', source=Glob('*.o'), LIBS=['boost_filesystem-mt', 'boost_system-mt', 'boost_progr...

[C2664] cannot convert parameter 1 from 'overloaded-function' to '...'

Now I am try to use boost bind & mem_fn. But there's a problem to bind overloaded-function. How to resolve compile error of follow codes? boost::function< void( IF_MAP::iterator ) > bmf = std::mem_fun1< void, IF_MAP, IF_MAP::iterator >( &IF_MAP::erase ); boost::function< void( IF_MAP::iterator ) > bmf = boost::mem_fn< void, IF_MAP, IF_M...

Using boost::lock_guard for simple shared data locking

I am a newcomer to the Boost library, and am trying to implement a simple producer and consumer threads that operate on a shared queue. My example implementation looks like this: #include <iostream> #include <deque> #include <boost/thread.hpp> boost::mutex mutex; std::deque<std::string> queue; void producer() { while (true) { ...

Boost Regex not playing welll with Snow leopard

So I inherited code written in C++ that uses the Boost library. I could compile (using Code Blocks) and run the code on Linux Ubuntu but when I ported it over to the mac and installed the boost library, I can compile it using code blocks (and specifying the location of the regex libraries) but it won't run. It just gives me the error: ...

asio::io_service hangs on destruction

Hello, i have timer implemented with boost (144 -> newest lib). This timer is started within a boos thread. The timer also starts a thread in which an io_service hosts deadline timer until thread is terminated. so a continuous timer. The boost thread which needs the timer is create from within DLL. The DLL ExitInstance function is call...

boost interprocess

hi, I am using boost interprocess library for my application. I have a requirement such that i need to create an array of container handles in the starting bytes of shared memory. The array index is the object_type and the array slot will hold the container handle for the corresponding object type. On reading the boost interprocess ref...

Boost.Python method returned strings truncated, unexpected integer values

I'm using Boost.Python to expose JRA's BWRepLib so I can try to do some data mining on sc:bw replays in python and I've run into a small problem with the values being returned from the C++ methods. When running any old simple program such as the tutorial I get the expected value returned to python (a "hello, world" string that prints out...

using boost string algorithm with MFC CString to check for the end of a string

I need to check whether my CString object in MFC ends with a specific string. I know that boost::algorithm has many functions meant for string manipulation and that in the header boost/algorithm/string/predicate.hpp could it be used for that purpose. I usually use this library with std::string. Do you know a convenient way to use this ...

Release resource on boost::shared_ptr finalization

I do receive a shared_ptr from a library call, and pass it and some resource back into the library. The resource can only be deleted when the shared_ptr deletes its pointer: std::ofstream* out = new std::ofstream(); ... shared_ptr<Lib::SomeClass> writer = Library.createWriter(out); Library.appendWriter(writer); The library expects m...

Implementing equivalence relations in C++ (using boost::disjoint_sets)

Assume you have many elements, and you need to keep track of the equivalence relations between them. If element A is equivalent to element B, it is equivalent to all the other elements B is equivalent to. I am looking for an efficient data structure to encode this information. It should be possible to dynamically add new elements throu...

Dynamic matrix with contiguous storage

I want a matrix container class that has similar functionality to vector<vector<type>>, but stores elements in contiguous memory. I bet there is none in the standard library (including C++0x); does Boost provide one? ...

Boost threads: is it possible to limit the run time of a thread before moving to another thread.

I have a program with a main thread and a diagnostics thread. The main thread is basically a while(1) loop that performs various tasks. One of these tasks is to provide a diagnostics engine with information about the system and then check back later (i.e. in the next loop) to see if there are any problems that should be dealt with. An...

Variable Argument lists with boost?

Hello I wanted to write a function with a variable argument list. I want to explore my options. I'm pretty sure I came accross a boost template class that was designed for this purpose, but I can't think of the name of it? Can anyone tell me? or did I dream this up! Thanks ...

How to suppress boost::thread warnings with gcc ?

Hi, In my project, I recently decided to use boost::thread. My code compiles fine under Linux, but under Windows (either x86 or x64), I get the following warnings with gcc 4.5: In file included from C:\Boost\include\boost-1_44/boost/thread/shared_mutex.hpp:14:0, from C:\Boost\include\boost-1_44/boost/thread/detail/thre...

parsing robots.txt file using c++

Hello, is there is any library to check robots.txt or else how can i right it in c++ with boost regex please explain with some examples.... ...

Why doesn't this boost asio code work correctly?

This boost udp server doesn't function as expected. It is identical to the blocking UDP echo server EXCEPT for a minor change. I'm using a different socket to return the response, i.e. sock2. Now this code works perfectly if the client is on the same machine as the server. But the moment I run this on a different machine, the response i...

boost compressed matrix storage

The boost ublas::compressed_matrix should only allocate space for non-zero elements. But in the below example, I am getting strange results. #include <boost/numeric/ublas/matrix_sparse.hpp> #include <boost/numeric/ublas/io.hpp> using namespace std; using namespace boost::numeric::ublas; int main () { { compressed_matrix<double,row...

C++: How to create an array using boost::property_tree?

I don't see a way to create an array using boost::property tree. The following code ... #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> #include <iostream> int main() { try { boost::property_tree::ptree props; props.push_back(std::make_pair("foo", "bar")); props.push_back(std::make...

Can we split, manipulate and rejoin a string in c++ in one statement?

Hello, This is a bit of a daft question, but out of curiousity would it be possibly to split a string on comma, perform a function on the string and then rejoin it on comma in one statement with C++? This is what I have so far: string dostuff(const string& a) { return string("Foo"); } int main() { string s("a,b,c,d,e,f"); vect...

Boost.Bind - understanding placeholders

I am trying to understand the following example, that is similar (but not equal) to the one posted earlier on the SO http://stackoverflow.com/questions/2120725/help-understanding-boostbind-placeholder-arguments : #include <boost/bind.hpp> #include <functional> struct X { int value; }; int main() { X a = { 1 }; X b = {...