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...
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...
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?
...
Having no experience with threading in the past, which threading technique in C++ will be the easiest for a beginner? boost::thread or pthreads?
...
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...
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...
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...
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...
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 << "...
I need to pass -Wl,-rpath,\$$ORIGIN/lib/ to g++'s linker (reason). Is there a way to pass this argument in Jamroot file?
...
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...
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...
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...
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();
...
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);
...
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...
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...
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...
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...
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...