boost

Boost Thread ID Invalid

Hello to all, i have bunch of question regarding to boost thread ? How to initialize the boost thread ID with the thread constructor? Why the thread id becomes invalid after called join() function ? As usual, a class member function is copy to thread internal storage in order to execute the member function but i found out that someo...

c++ Url Parser using boost regex match

Hello, how can i parse an url in c++ with boost regex like i have an url http://www.google.co.in/search?h=test&q=examaple i need to split the base url www.google.com and then query path search?h=test&q=examaple ...

can scoped_ptr and shared_ptr be mixed?

Hi! Imagine I create an instance of Foo on the heap in a method/function and pass it to the caller. What kind of smartpointer would I use? smartptr new_foo() { smartptr foo = new Foo(); return foo; } void bar() { smartptr foo = new_foo(); foo->do_something(); // now autodelete foo, don't need it anymore } Ok... n...

Getting a buildable Boost extract with bcp

I'm using bcp to extract Boost.Archive from Boost. Unfortunately I can't build this extract. Boost.Archive is not a header-only library. bjam complains Unable to load Boost.Build: could not find "boost-build.jam" Is there any way to tell bcp to make the extract buildable with bjam (copy boost-build.jam to the right place)? ...

boost.serialization and replace existing method of serializing std::wstring

Hi! I need to serialize std::wstring by my own method. How to force boost to use my methods of serialization instead of default methods? Thanks. ...

boost shared_from_this<>()

Hello all, could someone summarize in a few succinct words how the boost shared_from_this<>() smart pointer should be used, particularly from the perspective of registering handlers in the io_service using the bind function. EDIT: Some of the responses have asked for more context. Basically, I'm looking for "gotchas", counter-intuitive ...

Why is std::function not equality comparable?

This question also applies to boost::function and std::tr1::function. std::function is not equality comparable: #include <functional> void foo() { } int main() { std::function<void()> f(foo), g(foo); bool are_equal(f == g); // Error: f and g are not equality comparable } The operator== and operator!= overloads are declared ...

C++/STL Graphviz and Boost - Seg Fault Problem

I am using the dot language to create a graph using Boost. My Graphs are huge and I am trying to delete graphs that are no longer used. Under boost/graph/graphviz.hpp I added a function to remove a vertex: virtual void do_remove_vertex( const node_t& node) { bgl_vertex_t v = bgl_nodes[node]; clear_vertex(v,graph_); ...

Why would a friend function be defined as part of a struct - boost thread_data?

I'm trying to understand some boost code which is causing PC-Lint grief and uses the friend keyword in a way which I didn't think was legal C++ but compiles OK in VS2008. I thought I understood friend as a way to declare classes and functions. I didn't think it was legal to use on a function definition like this. However, the MSDN page ...

boost::threads execution ordering

hello i have a problem with the order of execution of the threads created consecutively. here is the code. #include <iostream> #include <Windows.h> #include <boost/thread.hpp> using namespace std; boost::mutex mutexA; boost::mutex mutexB; boost::mutex mutexC; boost::mutex mutexD; void SomeWork(char letter, int index) { boost:...

How could I change boost release variant to use cxxflags=-O2 ?

On my machine cxxflags for variant=release is -O3 by default. I need to change it to -O2. Please advise how to proceed. I am fine with defining a new variant as well, if someone could advise me on that. ...

problem in boost in l win7

i am using visual c++ 2010 in win7 i have following code #include <iostream> #include <boost/asio.hpp> #include <boost/date_time/posix_time/posix_time.hpp> int main(){ boost::asio::io_service io; boost::asio::deadline_timer t(io,boost::posix_time::seconds(5)); t.wait(); std::cout<<"hello world"; return 0; } but ...

boost problem in windows 7

i have posted this question third times please help i have following code #include <iostream> #include <boost/asio.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/filesystem.hpp> #include <boost/system/windows_error.hpp> using namespace boost::system; int main(){ boost::asio::io_service io; boost::as...

Automatic library selection

Hi, I noticed that when linking boost libraries in VS2010, I only need to specify the linking directory, and the compiler automatically selects the right libary to link. How can I do the same with my libraries? ...

C preprocessor macros: check if token was declared

This is for the C preprocessor experts: How can I declare an enum with a list of some identifiers and later during the switch-statement check if an identifier was included in the list? Example of what I need: typedef enum { e1, e2, e3, e4, e5, e6 } e; e x; switch (x) { #if DECLARED_IN_ENUM (e1) case e1 : ... #endif /* etc. */ } ...

Tridiagonal matrix class in Boost c++

Does boost provide any classes to implement a tridiagonal matrix? ...

Problem with boost library in C++ project

Hi, I'm attempting to use the boost library in my C++ project (Visual Studio 2008). However on including the boost functions for time: #include <boost/date_time/gregorian/gregorian.hpp> I get the following error (along with a number of warnings): fatal error LNK1104: cannot open file 'libboost_date_time-vc90-mt-gd-1_44.lib' ...

Assigning boost::iterator_range to singular range

I'm using Boost.Range to pass around some data and a container class for this data. The data is loaded in a different thread and may in some cases not be ready yet. In this case the container is initialized with the default iterator_range, hence containing singular iterators. I'm doing assignments and copying of the data containers (henc...

Using boost::bind and boost::lambda::new_ptr to return a shared_ptr constructor

Given a class A, class A { public: A(B&) {} }; I need a boost::function<boost::shared_ptr<A>(B&)> object. I prefer not to create an ad-hoc function boost::shared_ptr<A> foo(B& b) { return boost::shared_ptr<A>(new A(b)); } to solve my problem, and I'm trying to solve it binding lambda::new_ptr. boost::function<boost::shared_p...

How to implement template class with template-dependent signal member from boost?

I try to implement a template class which requires to have a signal member that depends on the template argument. My first idea was to realize it like the following: template<class T> class SignalClass { typedef boost::signals2::signal<void (T &)> OnReceive; public: SignalClass(const OnReceive::slot_type &_slot) { m...