I'm using Boost.Python to wrap a C++ library.
How do I ensure that the same Python instance (by object identity) is always returned for a particular C++ instance (by pointer identity)? I can't extend the C++ classes, but I can add a member variable (such as a PyObject * or a boost::python::handle<>) if that helps. I'm thinking that I sh...
I have a Boost Graph with VertexList=vecS.
typedef adjacency_list <listS, vecS, undirectedS, TrackInformation, LinkInformation> TracksConnectionGraph;
Now I want to iterate through my vertices and remove those that have a specific property. How can I do this?
The problem is whenever I call remove_vertex, the iterator to the vertices ...
I have a class:
class foo {
private:
std::string data;
public:
foo &append(const char* str, size_t n) { data.append(str,n); }
// for debug output
template <typename T>
friend T& operator<< (T &out, foo const &f);
// some other stuff
};
template <typename T>
T& operator<< (T &out, foo const &f) {
return out...
I have the following code (which largely follows the first example here: http://www.boost.org/doc/libs/1_42_0/libs/multi_index/doc/examples.html)). For some reason, with only 10000 insertations to the multi-index, it takes several minutes to run the program. Am I doing something wrong or is this expected?
struct A
{
int id;
in...
I have a suspicion that there might be a race condition in a certain C++ multithreading situation involving virtual method calls in a vtable dynamic dispatching implementation (for which a vtable pointer is stored as a hidden member in the object with virtual methods). I would like to confirm whether or not this is actually an issue, an...
I've been "playing around with" boost threads today as a learning exercise, and I've got a working example I built quite a few months ago (before I was interrupted and had to drop multi-threading for a while) that's showing unusual behaviour.
When I initially wrote it I was using MingW gcc 3.4.5, and it worked. Now I'm using 4.4.0 and i...
I am trying to install Boost on an unix cluster machine following the Boost instructions
I downloaded boost_1_43_0.tar.bz2 and was then instructed to execute the following command:
tar --bzip2 -xf /path/to/boost_1_43_0.tar.bz2
However it didn't work and this is the output I get:
tar --bzip2 -xf
/path/to/boost_1_43_0.tar.bz2
...
I'm using to do some serialization stuff "as it can be seen here". That worked fine, but I couldn't figure how to get the size of the written buffer.I've searched on boost documentation and apparently there is no way to do this aside of building a sink/source by myself?
Thanks
...
I have almost the same problem as described here. But I'm linking with release version of boost.
I build it by myself under WindowsXP with gcc-toolset
bjam --build-dir=build-directory
toolset=toolset-name link=shared
variant=release threading=multi
linking as
g++ -enable-auto-import -omain.exe main.o -L"path_to_boost_libdir...
I am having a problem where I am trying to serialize a message of a template class. The template's class message is of type BaseClass, but I want it to serialize the derived versions of the class. As of right now, it is only serializing the BaseClass. How am I supposed to register with boost::serialization the types of the derived classe...
Hello,
I have some code to handle resource (images, fonts, mesh data, etc.) management using a template'd static class, allowing client code to do something like:
ResourceManager<Texture>::init("data/textures");
ResourceManager<Font>::init("data/fonts");
// later ...
boost::shared_ptr<const Texture> tex = ResourceManager<Texture>::getR...
How to understand the " the list of endpoint entries "
and these codes:
tcp::resolver resolver(io_service);
tcp::resolver::query query(address, port);
accepter_.reset(new tcp::acceptor(io_service, *resolver.resolve(query)));
http://www.boost.org/doc/libs/1_42_0/doc/html/boost_asio/reference/ip__basic_resolver/resolve/overload1.html
...
From the documentation on the boost site for lexical cast it states that when converting from a numeric type to a string type the conversion can throw a bad_lexical_cast. Clearly in this case we should always handle this exception should it be thrown.
My question is, what about the other way around, going from a numeric type to a string...
I would like to know what's the process, when binding C++ libraries that are written with in a generic way.
Is there a posibility of binding a template class, or you can only bind only a template generated class ?
...
Hello,
This seems like such a basic question, so I apologize if it's already been answered somewhere (my searching didn't turn up anything).
I just want to filter a string object so that it contains only alphanumeric and space characters.
Here's what I tried:
#include "boost/algorithm/string/erase.hpp"
#include "boost/algorithm/strin...
The documentation for boost's specialized iterator adaptors states that boost::reverse_iterator "Corrects many of the shortcomings of C++98's std::reverse_iterator."
What are these shortcomings? I can't seem to find a description of these shortcomings.
FOLLOW-UP QUESTION:
How does boost::reverse_iterator correct these shortcomings?
...
My program reads dozens of very large files in parallel, just one line at a time. It seems like the major performance bottleneck is HDD seek time from file to file (though I'm not completely sure how to verify this), so I think it would be faster if I could buffer the input.
I'm using C++ code like this to read my files through boost::i...
Hi,
I am trying to write a code that calls a class method given as template parameter. To simplify, you can suppose the method has a single parameter (of an arbitraty type) and returns void. The goal is to avoid boilerplate in the calling site by not typing the parameter type. Here is a code sample:
template <class Method> class WrapMe...
I am writing Qt-based app with Blender-like functionality. It consists of a 'framework' which is GUI + plugin system and plugins. Plugins are Qt dlls with objects (e.g. a Sphere, a Box, etc.) that can be basically created and displayed. All those objects, once created, are stored in the framework in some kind of a container structure whi...
Hi. After porting a code segment from Windows to Mac OS X, I found it to consume a whole CPU core while running; the responsible call for the CPU consumption is boost::interprocess::interprocess_semaphore::timed_wait.
Here follows the code portion which reproduces this behaviour.
#include <boost/interprocess/sync/interprocess_semaphore...