boost

c++ stl: a good way to parse a sensor response

Attention please: I already implemented this stuff, just not in any way generic or elegant. This question is motivated by my wanting to learn more tricks with the stl, not the problem itself. This I think is clear in the way I stated that I already solved the problem, but many people have answered in their best intentions with solution...

boost::function and boost::bind are cool, but what is really cool about boost::lambda ?

On Page 175 Paragraph 1 of Effective C++ Meyers has this to say about generalized functors and binding: I find what tr1::function lets you do so amazing, it makes me tingle all over. If you're not tingling , it may be because you're staring at the definition of ... and wondering what's going on with the .... And I agree w...

Iterating over the types in a boost::variant

I'm using a boost variant to hold some generated types, right now my code generator creates a header with the types and a variant capable of holding them. At initialization time, I'd like to iterate over the allowable types in the variant, not the types the variant is holding at the moment. Can I do this with a variant? ...

PThread vs boost::thread?

Having no experience with threading in the past, which threading technique in C++ will be the easiest for a beginner? boost::thread or pthreads? ...

How to include boost::thread in your C++ project?

What do I need to do to include boost::thread in my project? I have copied the whole thread folder to my working path (I wish to be able to run this on several computers) and I get fatal error C1083: Cannot open include file: 'boost/thread/detail/platform.hpp': No such file or directory From the line #include "thread/thread...

Compiler error with boost iterator adaptor

I am trying to write a simple STL iterator for CArray MFC class using boost iterator adaptor. This is my code: #include <boost/iterator/iterator_adaptor.hpp> #include <afxtempl.h> class CArrIter : public boost::iterator_adaptor< CArrIter , int, int, boost::random_access_traversal_tag > { public: CArrIter(CArray<int,in...

Python method to boost function

I have a method exported to Python using boost python that takes a boost::function as an argument. From what I have read boost::python should support boost::function without much fuss, but when I try to call the function with a python method it gives me this error Boost.Python.ArgumentError: Python argument types in Class.createTim...

C++ standard/de facto STL algorithm wrappers.

hello Are there any standard/de facto standard (boost) wrappers around standard algorithms which work with containers defining begin and end. Let me show you what I mean with the code: // instead of specifying begin and end std::copy(vector.begin(), vector.end(), output); // write as xxx::copy(vector, output); I know it can be writte...

Why does this code using `::boost::bind` get a compiler error?

This code: #include <boost/signals.hpp> #include <boost/bind.hpp> #include <boost/mem_fn.hpp> #include <iostream> class Recorder : public ::boost::signals::trackable { public: void signalled() { const void *me = this; ::std::cerr << "Recorder at " << me << " signalled!\n"; } }; void signalled() { ::std::cerr << "...

Boost::Python: Passing custom arguments to gcc when building python-extension

I need to pass -Wl,-rpath,\$$ORIGIN/lib/ to g++'s linker (reason). Is there a way to pass this argument in Jamroot file? ...

Modifying items of boost multi index container

struct tagEnumdef{}; struct tagName{}; struct tagWidget{}; template< class type > class ParamTags; template<> class ParamTags<int> { public: typedef tagEnumdef tag; }; template<> class ParamTags<QString> { public: typedef tagName tag; }; template<> class ParamTags<QWidget*>{ public: typedef tagWidget tag; }; typedef boost::multi...

Why does this C++0x program generates unexpected output?

This program: test_header.hpp #include <boost/signal.hpp> #include <utility> class Sensor; class Recorder : public ::boost::signals::trackable { public: explicit Recorder(int id) : id_(id) {} // Cannot be copied Recorder(const Recorder &) = delete; Recorder &operator =(const Recorder &) = delete; // But can be moved...

Undefined references when trying to link Qt app with my static library.

Hello, I have a static library that I have built with MinGW, I am trying to link to that library from a Qt application. I keep getting linker errors caused by one of the object files in the library. This file actually declares a couple of Boost headers, one for use of shared_ptr and the other so I can make a class noncopyable. I belie...

None in boost.python

I am trying to translate the following code d = {} d[0] = None into C++ with boost.python boost::python::dict d; d[0] = ?None How can I get a None object in boost.python? ANSWER: boost::python::dict d; d[0] = boost::python::object(); ...

using boost::iostreams to read specifically crafted data, then based on that create object and append it to list

I have an interesting problem. Let's say that i have file with lines filled like this: name1[xp,y,z321](a,b,c){text};//comment #comment name2(aaaa); also I have (simplified) class: class something { public: something(const std::string& name); addOptionalParam(const std::string& value); addMandatoryParam(const std::string& value); ...

Which boost libraries are heading for TR2?

If found this quote at boost.org: More Boost libraries are in the pipeline for TR2 It links to the TR2 call from proposals. But I can't seem to find any other information on which boost libraries are headed for TR2. I've seen a draft proposal for Boost.Asio, and I vaguely remember seeing something about Boost.System and Boost.Fil...

Simple proxy program with BOOST

Hi all... I'm trying to do a very simple program. It's actually a proxy, that I need to connect to it and that proxy fowards the packets to the outter world. I think of making a list of incomming packets, change the incomming port to a new port, forward the packet and wait for a response, and get the port number for the packet from my...

Is it possible to generate a .h macros file from bjam?

I need to dynamically generate some macros into a .h configuration file that C programs can include in order to check which options are enabled, in a fashion similar to what is possible with CMake's CONFIGURE_FILE macro. But after looking in the doc and the web, I could not find something useful. Is it possible to generate such a file fr...

boost::filesystem exists() on directory path fails, but is_directory() is ok

I'm getting path to current directory with boost filesystem, then checking if the directory exists. is_directory() is ok, but exists() fails on the same path, am I missing something? Example code (boost 1.35): #include <boost/filesystem/operations.hpp> #include <boost/filesystem/path.hpp> namespace fs = boost::filesystem; // the pat...

How to flush file buffers when using boost::serialization?

I'm saving a file on an USB drive and need to make sure that it's completely written to avoid corruption in case the USB drive is not removed properly. Well I've done some research and it seems this is possible via calling the FlushFileBuffers Win32 function. But the problem is, I'm saving using boost::serialization and thus don't have a...