boost

Will a boost smart pointer help me?

Hi, i am using Xerces to do some xml writing. here's a couple of lines extracted from my code: DOMLSSerializer *serializer = ((DOMImplementationLS*)implementation)->createLSSerializer(); serializer->release(); Is there a boost smart pointer that i can use, so i can avoid calling serializer->release(); as it's not exception safe. The ...

Strange behavior with static template'd class.

Hello, I've been having some difficulties with diagnosing a segmentation fault resulting from, or at least I think resulting from a template'd static class (see original post here http://stackoverflow.com/questions/3200360/help-understanding-segfault-with-stdmap-boostunordered-map). Since posting that I found some other bizarre behavio...

[Boost-Spirit] Assigning or modifying inherited attributes in rule and propagating results to parent rule

Say I have a Boost Spirit grammar like this, where a parent rule passes an inherited attribute to its children. template <typename Iterator> struct MyGrammar : qi::grammar<Iterator, vector<Foo>()> { qi::rule<Iterator, vector<Foo>()> start; qi::rule<Iterator, vector<Foo>(Bar)> parent; qi::rule<Iterator, Foo(Bar)> child1; ...

qt signals/slots in a plugin

I have an app with such structure: all the datatypes (class INode) are stored in plugins (DLLs). Some of the datatypes can be drawn (if they're IDrawable). To load an object of, e.g. class PointCloudNode: public INode I have a special input plugin (DLL) which is called class PointCloudParser: public IIOPlugin and IIOPlugin is a thread ...

How to print boost::any to a stream?

I have a Map std::map<std::string, boost::any>, which comes from the boost::program_options package. Now I would like to print the content of that map: for(po::variables_map::const_iterator it = vm.begin(); it != vm.end(); ++it) { std::cerr << it->first << ": " << it->second << std::endl; } Unfortunately, that is not possible becau...

What should i code to get into the depths of advanced C++?

Hi all, i'm looking for project suggestions that would force me to "get my hands dirty" with advanced C++ features. I'm talking about projects that would utilize the full power of the language (STL or even boost (didn't use it much yet)). Why? Because i want to learn, i want to find new challenges. At work, things start to be boring, r...

How to get the return type of a boost::signal?

I use boost::signal with different function signatures and different combiners. In a class that looks like the one beyond I want to get the return of a certain signal declaration. template<typename signal_type> class MyClass { signal_type mSignal; signal_type::result_type getResult() { return mSignal(); } } But signal_type:...

using boost multi_index_container to preserve insertion order

I initially started out using a std::multimap to store many values with the same key, but then I discovered that it doesn't preserve the insertion order among values with the same key. This answer claims it can be done with boost::multi_index::multi_index_container, but gives no example. Looking through the docs, there are no examples ...

how to append a matrix to the end of another matrix? (using Boost Libraries in C++)

I have this: using namespace boost::numeric::ublas; matrix<double> m (3, 2); int k = 0; for (int j = 0; j < m.size1 (); j++) { for (int i = 0; i < m.size2 (); i++) m (j, i) = k++; } m = 0 1 2 3 4 5 And I need to append another matrix m2 to m matrix<double> m2 (3, 1); k = 0; ...

Problem with boost::bind

The following code throws an error at the line where I want to create a functor object of Test::fun2: #include <boost/shared_ptr.hpp> #include <boost/bind.hpp> #include <boost/function.hpp> using namespace boost; class Test { public: float fun1() { return 0.0f; } void fun2( float x ) {} }; int main( int argc, char* argv[] ) { s...

ptr_vector - _CrtDumpMemoryLeaks() - memory leaks even though destructor is called

Hi. I'm working on a game engine and in an earlier question it was suggested that I start using boost::ptr_vector to maintain a list of pointers. The basic idea is to have several State's, each State has a SceneGraph. Each state has several resources that they initialize, and then stuff its own SceneGraph. The SceneGraph has a boost::p...

boost static_assert with message?

Hi, on 1.43 boost it seems that BOOST_STATIC_ASSERT just allows to put a boolean value, is there some alternative that allows me to display a message as well on the compile error? ...

Are there any extensions for either Boost.Test or cppUnit which could provide HTML outputs etc?

Hi, I am involved in development of unit level test cases for our project. There are both managed code and native C++ code. After some study I chose NUnit for managed code. I would either use Gallio or FireBenchmarks which is an extension to provide HTML outputs and charts etc. Do we have extensions like this for cppUnit or Boost.Tes...

C++ optimization question

Hello! I have some mid-large project that is actively using boost libraries and, hence, suffers in terms of Debug application performance (Visual Studio 2008). Solution that I use right now means turning on function inlining even in Debug mode, which brings enough performance, but should definitely have some drawbacks. Does anyone kno...

Example of UUID generation in c++

Hi everyone, I'm quite a newbie in c++ and I want to generate just random UUID's, as it is just important for instances in my program to have unique identifiers. I looked into Boost UUID, but I can't manage to generate the UUID because I don't understand which class and method to use. In Java it is as simple as java.util.UUID.randomUU...

Design choices for high performance file serving

I'm developing an application under linux that will need to support around 250 connections and be transmitting large files over TCP sockets in the 100MB+ size range. The aim is to tune for throughput rather than latency. I want to keep saturated 2x1Gbit ethernet connectons at all times. These will be channel bonded. It's expected tha...

Light weight container around const char* & length without copying the data

I have a underlying API that passes a const char* and a length: foo(const char* data, const uint32_t len); I'd like to wrap this data/length in a light weight container that can be iterated and has the ability to be randomly accessed but not make a copy (e.g. like a vector). What is the best way to achieve this? The const char* data i...

Calling member functions from DLL (AI library for games)

My problem is this: I am trying to implement a C++ library which can call functions in the base EXE. I am trying to have a minimum amount of code on the EXE side to get the functionality to work. At the moment I have DLL-side entities which are created by DLL function calls. These entities hold a container of "actions" which is just a ...

How can I catch my custom exception with Boost.Test?

When I'm testing my C++ class with Boost.Test and my custom exceptions are thrown (they are instances of my class), this is the message I see in log: unknown location:0: fatal error in "testMethod": unknown type It's very un-informative and I don't know how to teach Boost.Test to convert my exception to string and display it properly....

Correct way to initialize array of boost::scoped_ptr ?

I have a class with an array of scoped pointers to objects which do NOT have a default constructor. The only way I've found to "initialise" them is using swap() like this: class Bar { Bar(char * message) {}; } class Foo { boost::scoped_ptr<Bar> arr[2]; Foo() { arr[0].swap(boost::scoped_ptr<Bar>( new Bar("ABC") )); ar...