boost

Static Compile of Thread Example

I compiled the Boost C++ libraries as follows: bjam install variant=release link=static threading=multi runtime-link=static No errors. Then I compiled the following source: #include <boost/thread/thread.hpp> #include <iostream> #define BOOST_THREAD_NO_LIB void hello() { std::cout << "Hello world, I'm a thread!" << std::endl; } i...

Using Boost with Team Foundation Server

What would be a good way to use Boost in a small team (< 10 people) and lower the time between joining the team and building the application as much as possible. I basically want a workflow like this... Set up the TFS with the new person's username + password. Have them log into the TFS from Visual Studio. Check out the team project (w...

removing strings from a vector via boost::bind

I am trying to remove short strings from a vector. std::vector<std::string> vec; // ... vec.erase(std::remove_if(vec.begin(), vec.end(), boost::bind(std::less<size_t>(), boost::bind(&std::string::length, _1), 5),...

How to use boost normal distribution classes?

Hi all, I'm trying to use boost::normal_distribution in order to generate a normal distribution with mean 0 and sigma 1. The following code doesn't work as some values are over or beyond -1 and 1 (and shouldn't be). Could someont point out what I am doing wrong? #include <boost/random.hpp> #include <boost/random/normal_distribution.hpp...

Using boost.asio in cMake

I am relatively new to cMake, and I'm trying use the boost asio library in my project. I was able to get cMake to find other boost libraries such as smart_ptr and lexical_cast, but I get a linker error when I try to include boost/asio.hpp: LINK : fatal error LNK1104: cannot open file 'libboost_system-vc90-mt-1_40.lib'. I then tr...

ublas matrix expression tutorial/examples

hi I am trying to implement certain matrix operations but I am lost in the internals of ublas library. is there a resource such as tutorial or an example on how to implement new ublas matrix expressions? Thanks ...

How do I use chi square distribution with C++ Boost library?

I've checked the examples in the Boost website, but they are not what I'm looking for. To put it simple, I want to see if a number on a die is favored, using 600 rolls, so the average appearances of every number (1 through 6) should be 100. And I want to use the chi square distribution to check if the die is fair. Help!, how would I d...

Shared memory and strings: managed?

I have a problem with boost::interprocess::string in shared memory. When I use a shared_memory_object I can manipulate a structure with different fields, BUT strings (I get a segmentation fault). On the other side, when I use managed_shared_memory everything is fine. Am I doing something wrong? Do you know if there is a performance...

Can I use the C++ Boost shared_ptr to program as if I was coding in Java, as in, not care about memory management?

It's been a while I coded in C/C++, and now I need its efficiency for a project I'm doing. What I understand from this shared_ptr is that it basically deletes the object when I need it to. So, if, for example, my object has a vector of shared_ptr, I wouldn't have to worry about iterating through the vector and deleting each element in t...

Sharing boost .hpp files between platforms

I'm not very sure about this and I can't seem to find a complete answer. Some of boost's libraries need to be compiled (thread for example, as well as date time for some uses) - obviously one needs to compile them separately on each platform. What I am interested in is if the hpp files can be shared between platforms. I'm ultimately se...

Does the Boost unordered_map only work to associate items with integers?

I had a HashMap<Node, Double> in Java which I'd use later on to retrieve the double associated with a node. I've tried to do boost::unordered_map<Node*, double> but I get a "error C2108: subscript is not of integral type" when I try to put something in it, like: map[some_node] = some_double; If I interpreted the error right,...

Linking to boost unit test framework with boost build

Hello, Using boost build, if I can link to a boost python library with this in my jamfile: project myProject : requirement /boost/python//boost_python ; how can I link to boost test? I have built the boost test library. I don't want to use file paths since my code is portable. Thanks...

Maintaining a std::set<boost::shared_ptr>

I'm writing a game and an accompanying engine in C++. The engine relies heavily on automation using a simple embedded scripting language. Scripts can create object classes, define event listeners on them, and produce instances from them. At present, an instance must be bound to a script-global identifier in order to preserve its existenc...

Creating Java object with boost::posix_time::ptime serialized XML representation

Hello, I have following XML generated by serializing a boost::posix_time::ptime structure. I want to create a Java Date object with this XML. <timeStamp class_id="0" tracking_level="0" version="0"> <ptime_date class_id="1" tracking_level="0" version="0"> <date>20100119</date> </ptime_date> <ptime_time_duration class...

Use Boost.Signal instead of Qt's signals? Do without moc?

I know they can be used together, but I'm wondering whether it's possible to replace Qt's signals and slots mechanism with Boost.Signal in the Qt parts of the program (widgets and such). Anyone ever try it? Any gotchas? Assuming I don't use any other MOC features and replace signals/slots with boost.signal, is it possible to do without...

C++ application - should I use static or dynamic linking for the libraries?

I am going to start a new C++ project that will rely on a series of libraries, including part of the Boost libraries, the log4cxx or the google logging library - and as the project evolves other ones as well (which I can not yet anticipate). It will have to run on both 32 and 64 bit systems, most probably in a quite diverse Linux enviro...

boost serialization issue with shared_ptr to std containers

Hi I am using boost/1.41.0, and the following code give me compilation error when I try to deserialize a shared_ptr. The serialize part it compiled successfully. Can someone advise me if this is a bug in my code or a general issue for boost? Thanks. Yanchao #include <iomanip> #include <iostream> #include <cstddef> // NULL #include <fst...

how to set base index in ublas matrix?

hello I have searched the web but could not find an answer. how do I have set base index in the matrix, such that indexes start from values other than zero? for example: A(-3:1) // Matlab/fortran equivalent A.reindex(-3); // boost multi-array equivalent thanks ...

Is it possible to use boost::foreach with std::map?

Hi, I find boost::foreach very useful as it saves me a lot of writing. For example, let's say I want to print all the elements in a list: std::list<int> numbers = { 1, 2, 3, 4 }; for (std::list<int>::iterator i = numbers.begin(); i != numbers.end(); ++i) cout << *i << " "; boost::foreach makes the code above much simplier: std::li...

C++ boost unit test error message

I would like to write a method in my test suite as follows: void checkParams(arg1, arg2, arg3) { BOOST_REQUIRE(arg1==1); BOOST_REQUIRE(arg2==2); BOOST_REQUIRE(arg3==3); } However, I want to write something to stderr if the assert fails. For example, if the first assert fails, I want to write: checkParams failed with arguments arg1=5...