boost

boost program_options multiple values problem

So I'm working off one of the examples for Boost program_options library, and I wanted to try setting a default value for one of the multiple-values/ vector-values, but it doesn't seem to work. As I think is suggested here to work. What I've modified is on about line 40: po::options_description config("Configuration"); config.a...

Boost : Error : 2 overloads have similar conversions

Hi, I'm basically brand new to using Boost. I'm trying to use a ptr_vector to handle some objects that I created. Specifically I have defined a class Location which defines a particular node on a map (simple 2D game layout). I defined a ptr_vector to hold a set of Locations that have value to the calling function (nodes with units on ...

PyV8 Install Problems (Cannot find boost)

I am attempting to install PyV8 (http://code.google.com/p/pyv8/) using: python setup.py install However, the build fails with the following: louis@louis-desktop:~/Downloads/PyV8-0.9$ python setup.py install running install running build running build_py running build_ext building '_PyV8' extension gcc -pthread -fno-strict-aliasing -D...

How understand data() method of boost::array, and return add length?

boost::array<char,7> buf = {'a','b','c','d','e','f','g'}; ... ... std::cout << buf.data() + 5; It's display: fg How to understand it? buf.data() + 5 Thanks ...

boost::iterator_facade and std::find(...)

Below is an implementation of an iterator_facade for a linked list node. It's pretty much the same as that presented in the docs except it has a Value* dereference type instead of Value&. The problem is with using the iterators with std::find, it throws these compile errors for the find template. edit One Several noted that std::find ...

boost::filesystem::rename: Cannot create a file when that file already exists

I'm renaming a file using boost::filesystem, and sometimes the target file will exist. According to the boost documentation here: http://www.boost.org/doc/libs/1_42_0/libs/filesystem/doc/reference.html#Non-member-functions template void rename(const Path1& from_p, const Path2& to_p); Requires: Path1::external_string_type and ...

Why must be 8192 in boost::array<char,8192>?

if not 8192, the complier tell me error error C2446: '!=' : no conversion from 'boost::array *' to 'boost::array *' C:\boost\boost_1_42\boost\smart_ptr\shared_ptr.hpp 391 HOW to understand 8192? ...

Allow limited number of possibilities for a option in boost program_options

Hi, Can I tell boost program_options somehow, that a specific options has a limited number of values? For example, the option "--verbosity" may only be debug,high or low?!? Thanks! Nathan ...

"pure virtual method called" when implementing a boost::thread wrapper interface

Hi, I have a small wrapper which centralize what's relative to threads : class Thread { protected: boost::thread *m_thread; virtual void work() = 0; void do_work() { work(); } public: Thread() : m_thread(NULL) {} virtual ~Thread() { catch_up(); delete m_thread; } inline void c...

Parsing with Boost Spirit, getting extra items

This is long with a lot of code, so I hope Stack Overflow can cope with it. :P I'm trying to write an SVG parser with Boost Spirit. I have a grammar that populates a vector with "Contours," which are vectors of "BezierPoints," which may represent either regular points or points with bezier controls. So far I have this (not handling re...

using BOOST_TYPEOF in expression.

Hello. Can the following be done in a single line? typedef BOOST_TYPEOF(generator) G; typename G::value_type next; typename BOOST_TYPEOF(generator)::value_type next; //does not compile thank you ...

C++ factory function with boost::noncopyable

hello. Suppose I need to implement factory function which returns object O which inherits/has members inheriting from boost::noncopyable. struct O : boost::noncopyable {}; O factory() { return O(); } Obviously returning value fails to compile. What method do you know or use to implement such factory methods? I really like to avoid ...

boost::thread build error (unable to link lib && unresolved external)

Hi all, I'm trying to follow a simple tutorial of Boost::Thread (ver 1.4-3) in VS 2008: #include <boost/thread/thread.hpp> void Func() { // Do something } void main() { boost::thread _thrd(&Func); _thrd.join(); .... } During compilation it produces this error: Error 1 fatal error LNK1104: cannot open file 'libboost...

boost::thread & member function

Hi all, I've facing this problem when trying to use boost::thread: unresolved external symbols: public: __thiscall boost::thread::~thread(void) public: __thiscall boost::thread::thread(void) Does anyone have any idea? ...

exceptions from boost::iostreams::copy()

In the below code, I have a corrupt "hello.bz2" which has stray characters beyond the EOF. Is there a way to make the boost::iostreams::copy() call to throw ? #include <fstream> #include <iostream> #include <boost/iostreams/filtering_streambuf.hpp> #include <boost/iostreams/copy.hpp> #include <boost/iostreams/filter/bzip2.hpp> int mai...

C++ boost template parameter traits

hello. I believe I had seen macro in boost that recovers template template parameters, for example: template<class> struct parameters; #define parameters(T) template<class A> \ struct parameters<T<A> > { typedef A type1; }; is there one like this, or am I wrong? Thank you ...

Soft (not: weak) references in C++ - Is it possible? Is there an implementation?

In C++ I'm using boost::shared_ptr and boost::weak_ptr to automatically delete objects that are no longer needed. I know these work with reference counting. In Java, memory is managed by a garbage collector, which consideres the built-in object references as strong, WeakReference as weak and SoftReference as something in between (may be...

How do i make a some sort of istream for a vector of unsigned chars

hello how can i create an istream from a buffer unsigned char* or vector. basically i want : void Func(vector<unsigned char> data) { someSortOfIstream x (data); x >> something; } using boost too.... ...

Link the static versions of the Boost libraries using CMake

I've got both the static and the dynamic versions of the boost libraries in /usr/lib. Now I'd like CMake to prefer the static versions during the linkage of my executable. What can I do? Thank you ...

how to organize test cases with boost::test library?

I have a project of 50+ .H/.CPP files/classes. I would like to test every class with its own test case, which will include methods for testing of different aspects of every class. My classes are located in different directories, like this: /project /include /SuperModule Foo.h Foo.cpp .. Alpha.h Alpha.cpp ...