boost

C++ boost startup tutorials

I am learning boost c++ libraries, installed boost and started reading their tutorial at http://www.boost.org/doc/libs/1%5F37%5F0/doc/html/variant/tutorial.html . I felt like I do not know anything even from c++ . I was stumped at some weird term called visitor. It didn't explained me clearly what that meant. Can somebody please point me...

A way to turn boost::posix_time::ptime into an __int64

Does anyone know if there is a good way to turn a boost::posix_time::ptime into an __int64 value. (I have compiled the microsecond version, not the nanosecond version). I need to do this somehow as I am looking to store the resulting __int64 in a union type which uses the raw data for a high-performance application. Some type of Memen...

How to build Boost-Libraries for iPhone

Hello Can someone tell me, where to find a detailed guide, how to build the Boost-Libraries for using it on the iPhone-Device. I've allready build the libs for Mac and can use them in my project (only on iPhone-Simulator). While building the project for iPhone-Device, XCode haunts me a warning: "file is not of required architecture" on...

How can i compile boost::spirit for unsigned char type?

boost::spirit asserts at boost::spirit::char_class::ascii::isalnum() when passing ascci characters > 127. I changed all my private variables from std::string to a typedef std::basic_string<unsigned char, std::char_traits<unsigned char>, std::allocator<unsigned char> > u_string; but still boost uses std:.string internally. Wha...

Signal and Slot vs Multithreading in Boost Library

I have gone through similar questions on Stackoverflow but still can't get a good answer: how boost implements signals and slots How signal and slots are implemented I am quite puzzled on how this signal/slot is achieved. Q1: From the following code, sig is connected to two function(Hello() and World()), and it seems that the funct...

Boost interrupt in naive polling implementation

I have a developed a simple polling thread (using Boost 1.39.0) which checks whether a data resource has been accessed within a given timeframe and clears the connection if not. The relevant code can be reviewed below. My concerns are twofold: 1) Is using interrupt on a sleep appropriate to close down the thread safely? Will the interr...

Hidden Features and Dark Corners of STL?

C++ developers, all know the basics of C++: Declarations, conditionals, loops, operators, etc. Some of us even mastered the stuff like templates, object model, complex I/O, etc. But what are the most hidden features or tricks or dark corners of C++/STL that even C++ fans, addicts, and experts barely know? I am talking about a seasoned...

Luabind Function using std::string& Reference with pure_out_value policy not possible?

I'am trying to return a string from a function but it doesn't compile. When I replace the std::string& type with int& it compiles, however I want to return additionally to the boolean a std::string how do I do this? bool luacw_getElementContent( std::string name, std::string& content, bool fromBeginning ) { content = "test"; retur...

using boost::mpl::bitor_

I have a class that accepts a list of policy classes using boost::mpl. Each policy class contains an identifying tag. I would like MyClass to produce the OR-ed result of each policy class' identifying tag. Unfortunately, I'm having some trouble figuring out how to correctly use the boost::mpl::fold<> functionality. If anybody can help, I...

How to design an efficient image buffer in C++?

I am trying to create a data buffer, more specifically, an image buffer, which will be shared among multiple modules. Those modules only reads from the buffer and don't communicate with each other at all. My difficulty is: 1.Large data size: larger than 10M per image, that means copying those data around for different threads is not...

Sending large chunks of data over Boost TCP?

Hello, I have to send mesh data via TCP from one computer to another... These meshes can be rather large. I'm having a tough time thinking about what the best way to send them over TCP will be as I don't know much about network programming. Here is my basic class structure that I need to fit into buffers to be sent via TCP: class Pr...

templates problem ('typename' as not template function parameter)

Actually I've a problem with compiling some library with intel compiler. This same library has been compiled properly with g++. Problem is caused by templates. What I'd like to understand is the declaration of **typename** as not template function parameter and variable declaration inside function body example: void func(typename so...

Cross compile Boost 1.40 for VxWorks 6.4

I'm trying to migrate a project which uses Boost (particularly boost::thread and boost::asio) to VxWorks. I can't get boost to compile using the vxworks gnu compiler. I figured that this wasn't going to be an issue as I'd seen patches on the boost trac that purport to make this possible, and since the vxworks compiler is part of the gnu...

Using shared_ptr in dll-interfaces.

I have an abstract class in my dll. class IBase { protected: virtual ~IBase() = 0; public: virtual void f() = 0; }; I want to get IBase in my exe-file which loads dll. First way is to create following function IBase * CreateInterface(); and to add the virtual function Release() in IBase. Second way is to create a...

boost::unordered_map maintains order of insertion?

I am looking for a container which provides std::map like interface but maintains the order in which elements are inserted. Since there will not be too many elements in the map, the lookup performance is not a big issue. Is boost::unordered_map will work in this case? i.e. does it maintain the order of insertion. I am new to boost librar...

Using Boost Python with Weak Ptrs?

Trying to set up a dependency in C++ with a parent-child relationship. The parent contains the child and the child has a weak pointer to the parent. I would also like to be able to derive from the parent in Python. However, when I do this, I get a weak pointer error connecting up this parent-child relationship. C++ code: #include <boo...

Boost multi-index container with index based on nested values

If I have an object like this: struct Bar { std::string const& property(); }; I can create a multi-index container for it like this: struct tag_prop {}; typedef boost::multi_index_container< Bar, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< boost::multi_index::tag<tag_prop>, boost::multi_index...

Can BOOST_STATIC_ASSERT give a custom compilation error string?

Is it possilbe to get BOOST_STATIC_ASSERT to give a custom compilation error message? I belive the following is an attempt to do that in the code base I'm working in. BOOST_STATIC_ASSERT( (MAX_NUMBER_OF_USERS == 15) && ("MAX_NUMBER_OF_USERS is no longer set to 15") ); Personally I'm not sure the error message gives anything - I'd rath...

Mocking using boost::shared_ptr and AMOP

Hi, I'm trying to write mocks using amop. I'm using Visual Studio 2008. I have this interface class: struct Interface { virtual void Activate() = 0; }; and this other class which receives pointers to this Interface, like this: struct UserOfInterface { void execute(Interface* iface) { iface->Activate(); } }; So I try...

Is it possible to wrap boost sockets with Pimpl?

Hi, in a project we want to wrap the Boost Asio socket in a way, that the using class or the wrapping .h does not have to include the boost headers. We usually use pointers and forward declarations for wrapped classes. Foward declaration: namespace boost { namespace asio { namespace ip { class udp; } } } And...