boost

Does ptr_vector iterator not require increments?

#include <boost/ptr_container/ptr_vector.hpp> #include <iostream> using namespace std; class Derived { public: int i; Derived() {cout<<"Constructed Derived"<<endl;} Derived(int ii):i(ii) {cout<<"Constructed Derived"<<i<<endl;} ~Derived() {cout<<"* Destructed Derived"<<i<<endl;} }; int main() { boost::...

How to wrap nested customized C++ class (solved)

I am wrapping a C++-based data storage library for python using boost. The library is like this: class Container ... Piece* get(int index) ... ... class Piece ... Each Container (object) is composed of several Pieces. When Container.get is called it will return a pointer to Piece inside Container instead of a full copy. The pro...

What does this mean: "warning: comparison between 'enum A<B>' and 'enum A<B>'"?

I added following at line 42 of proto.h: typedef boost::make_unsigned<off_t>::type uoff_t; And now I get this verbose and confusing warning from gcc complaining about comparing an enum to the same enum type: In file included from proto.cpp:12: /usr/local/include/boost/type_traits/is_unsigned.hpp: In instantiation of 'boost::detail::i...

Standard C++ and MFC wrapper

Firstly, I want to have a clearly overall look at MFC, Win32API . Is: Win32API: The first layer between hardware and software in prog [ except assembly ] MFC : A wrapper by Microsoft ? It helps us in design GUI and a lot of library for easier and faster programming. My problem is : I want an easy coding in GUI, no need to write every ...

Boost.Spirit bug when mixing "alternates" with "optionals"?

I've only been working with Boost.Spirit (from Boost 1.44) for three days, trying to parse raw e-mail messages by way of the exact grammar in RFC2822. I thought I was starting to understand it and get somewhere, but then I ran into a problem: #include <iostream> #include <boost/spirit/include/qi.hpp> namespace qi = boost::spirit::qi; u...

Is _1 part of C++0x?

I've seen two recent answers using _1 as a pure C++0x solution (no explicit mention of boost lambdas). Is there such an animal as std::_1 I would think that having native lambdas will make such a construct redundant. A Google code search for std::_1 brings two results from the same project so that's inconclusive. ...

boost::regex and tilde (~)

Please could you explain why given the following boost::regex pattern: boost::regex re("/\\S+\\w"); /index.html is a match and /~index.html is not? RegexBuddy in Perl mode finds a match in both cases. Could you suggest a pattern that would work? Thanks!! P.S. The \\w at the end is needed in order to ignore the punctuation on the en...

Turning boost::tuples::cons<...> back into the corresponding boost::tuple<...>

For a little library project I'm using boost::tuple. Right now, I'm facing the problem of turning a "cons list" I operated on via metaprogramming back to a boost::tuple<...> type. The "dirty" solution would be to provide lots of partial specialications a la template<class T> struct id{typedef T type;}; template<class TL> struct type_li...

Can templates such as boost::mpl::integral_c be registered with Boost.Typeof?

boost::mpl::integral_c is declared as: template <typename T, T N> struct integral_c; Is it possible to register this sort of template with Boost.Typeof: For any T? For some T's? ...

boost_assert that a parameter class implements a certain method

Hi, Suppose you have a certain template that takes a parameter class template <typename ConnectorClass> struct myClass { } I want to add a BOOST_ASSERT_MSG to validate that ConnectorClass implements a certain method of signature returnType MethodName(param1, param2) How should i write the assert condition in this case? EDIT: si...

GMP and smart pointers

Hello. I'm working with gnump and have a function that must return mpz_t. So I have to use raw pointers to return a value. I allocate space with new for pointer and send it as a parameter in my function. I think it is better to use smart pointers. But I didn't work with them before. I read the manual but still can't understand how to ...

Build Boost and Exempi on a Mac

In order to install Python XMP Toolkit, I need to install Exempi on my Mac, but doing this is becoming a real nightmare... After a lot of trouble, i finally made it with boost, and had the fantastic The Boost C++ Libraries were successfully built! The following directory should be added to compiler include paths: /usr/loc...

Boost.MPI: What's received isn't what was sent!

I am relatively new to using Boost MPI. I have got the libraries installed, the code compiles, but I am getting a very odd error - some integer data received by the slave nodes is not what was sent by the master. What is going on? I am using boost version 1.42.0, compiling the code using mpic++ (which wraps g++ on one cluster and icpc o...

Parsing escaped strings with boost spirit

I´m working with Spirit 2.4 and I'd want to parse a structure like this: Text{text_field}; The point is that in text_field is a escaped string with the symbols '{', '}' and '\'. I would like to create a parser for this using qi. I've been trying this: using boost::spirit::standard::char_; using boost::spirit::standard::string; usi...

kill boost thread after n seconds

I am looking for the best way to solve the following (c++) problem. I have a function given by some framework, which returns an object. Sometimes it takes just miliseconds, but on some occasions it takes minutes. So i want to stop the execution if it takes longer than let's say 2 seconds. I was thinking about doing it with boost threads...

Operator = is ambiguous (C++)

I have the following in a for loop and the compiler says 'operator = is ambiguous'. Not sure how to solve this issue, can anyone help? rootelement = document->getDocumentElement(); boost::interprocess::unique_ptr<DOMNodeIterator, release_deleter> itera (document->createNodeIterator(rootelement, DOMNodeFilter::SHOW_ALL, NULL, true))...

Accessing vector element of shared object using boost interprocess

Hi, I'm trying to understand how boost interprocess library works. I have an Equipment class which holds integer values in a vector container. In parent parent process; I constructed Equipment object in MySegmentObject segment, and in the constructor of this object I created the vector in MySegmentVector segment. Using child process;...

How To Navigate Boost

I was reading over Boost ConceptCheck today, and encountered this warning in the implementation page: This documentation is out-of-date; similar but newer implementation techniques are now used. This documentation also refers to components and protocols in the library's old interace such as BOOST_CLASS_REQUIRES and constraints() fun...

"Interface" like semantics with boost::bind

I wanted to be able to have something like Java's interface semantics with C++. At first, I had used boost::signal to callback explicitly registered member functions for a given event. This worked really well. But then I decided that some pools of function callbacks were related and it made sense to abstract them and register for al...

Continuous boost::asio reads

Hi all, I'm experimenting with Boost::asio, and I'm trying to make a client that reads and outputs to console packets sent from a server. The server uses a proprietary protolcol. It sends a timer update every second, responds to ping, and can reply with a list of files when the client asks for it. I have a decent grasp of asynchronous n...