I am using a third-party C++ library (OpenFst), which is not particularly designed to be thread-safe. It does have some unused Mutex classes in there, though.
Now I would like to call some functions from that library and run them in Boost threads. How can I do that? Do I just have to write additional Mutex classes?
In particular, some ...
I've been working a couple of small c++ projects using the nuwen.net minGW distro and I've run into a problem trying to link against the boost::filesystem library. I am invoking g++ like this:
g++ -g -Wall -pedantic -std=c++0x -static-libgcc -o main.exe main.cpp -lmingw32 -lstdc++ -lboost_system -lboost_filesystem
However, this result...
Hi all,
I've been reading Alexandrescu's book, Modern C++ design , and I've been quite impressed by the techniques he uses, so I wanted to add Loki library to my application.
However, after further investigation, I saw that boost, that I'm already using, provides a lot of similar functionality (not all though, I couldn't find a singl...
I was having a look at the "Function" class documentation in Boost, and stumbled across this:
boost::function<float (int x, int y)> f;
I must admit this syntax is highly confusing for me. How can this be legal C++ ?
Is there any trick under the hood ? Is this syntax documented anywhere?
...
Please consider this -probably poorly written- example :
class Command;
class Command : public boost::enable_shared_from_this<Command>
{
public :
void execute()
{
executeImpl();
// then do some stuff which is common to all commands ...
}
// Much more stuff ...
private:
virtual void e...
Hello StackOverflow!
im trying to serialize some object as xml and then read it back
the code is:
IncomingTradeMessage inherits BaseMessage and contains InternalRequestInfo which in turn contains InternalTradeTransInfo. this is the code:
std::ostringstream oStringStream;
boost::archive::xml_oarchive xmlArchive(oStringStream);
xmlArch...
Hello, I've got this library for logging in boost. I have a question about installing. How to install it? Here is the latest version. There are 3 folder: boost, doc, libs. How can I install this library without recompiling all boost?
...
I am writing a Boost Spirit grammar to parse text into a vector of these structs:
struct Pair
{
double a;
double b;
};
BOOST_FUSION_ADAPT_STRUCT(
Pair,
(double, a)
(double, a)
)
This grammar has a rule like this:
qi::rule<Iterator, Pair()> pairSequence;
However, the actual grammar of pairSequence is this:
doub...
Hello, I'm using ptr_map from boost for storing objects derived from some base abstract type.
class Entity { virtual void foo() = 0; };
class Entity1 : public Entity {};
class Entity2 : public Entity {};
boost::ptr_map<string, Entity> someMap; // We could store pointers for abstract type
Inserting works great:
someMap.insert("someKe...
I'm currently using Boost's multi-index to help keep track of how many times a packet passes through a system.
Each time a system touches the packet, its IP address is added to a string, separated by commas. I go through that string then, tokenize it and add each IP found to a multi-index. Since the IPs are set to be unique right now, ...
I'm using Boost.Test for Unit testing and am currently running various mock servers in separate threads which get launched from within each test. In order to more accurately test my code the mock server's should really be in separate processes.
I was thinking about doing something along these lines:
MY_TEST()
if (fork() == 0) {
r...
Hello, I'm using ptr_map for storing different types of pointers.
boost::ptr_map<string, any> someMap;
I store there some templated class objects:
someMap.insert("1", new SomeClass<int>());
someMap.insert("2", new SomeClass<float>());
Now I want to get values from map. Here is a sample with references:
template<typename T>
T &get(...
I am trying to parse input string using regular expression. I am getting problem when trying to capture a repeating group. I always seem to be matching last instance of the group. I have tried using Reluctant (non greedy) quantifiers, but I seems to be missing some thing. Can someone help?
Regular expression tried:
(OS)\\s((\\w{3})(([...
For reasons that I will gloss over, I need to set aside space of a fixed size, and then use boost serialization to store an object there. The choice of archive format is arbitrary, and portability is not a concern.
The class is fairly complex (members include fundamental types, arrays, pointers, and child classes) and guaranteed to gro...
Hello, how can I get current time with library boost. I can do this:
ptime now = boost::posix_timesecond_clock::local_time();
tm d_tm = to_tm(now);
But the last time unit of tm structure is second and I need in millisecond. Can I get current time with milliseconds?
...
hello stack overflow!
i want to do something like c# linq style :
SomeColection <SomeType> someColection;
someColection.Remove(something => something > 2);
and it'll remove all the things that are bigger then 2 (or any other boolean condition)...
using boost in the project...
...
That's the question. Thanks in advance.
...
Hi there,
So I am wanting to use boost signals in my C++ program.
I add:
#include <boost/signal.hpp>
But I get this error when I build.
fatal error LNK1104: cannot open file 'libboost_signals-vc90-mt-gd-1_42.lib'
The lib file is not contained within my boost directory.
Typing 'libboost_signal' (with variations) into google hasn'...
hello.
My problem is, I have block matrix updated by multiple threads.
Multiple threads may be updating disjoint block at a time but in general there may be race conditions. right now matrix is locked using single lock.
The question is, is it possible (and if it is, how?)
to implement an efficient array of locks, so that only portions...
Hello dear Stackoverflow!
I'mm using boost to serialize and deserialize some classes
Like so:
boost::archive::xml_oarchive xmlArchive(oStringStream);
xmlArchive.register_type(static_cast<BaseMessage *>(NULL));
xmlArchive.register_type(static_cast<IncomingTradeMessage *>(NULL));
xmlArchive.register_type(static_cast<InternalRequestInf...