I'm doing a library that makes extensive use of a thread local variable.
Can you point to some benchmarks that test the performances of the different ways to get thread local variables in C++:
C++0x thread_local variables
compiler extension (Gcc __thread, ...)
boost::threads_specific_ptr
pthread
Windows
...
Does C++0x thread_local ...
I have a small project where I need just part of boost library, boost::regex in particular. This is what I've done so far:
/include
/boost
/regex
/math
.. 189 dirs, files, etc.
/lib
/boost-regex
c_regex_traits.cpp
cpp_regex_traits.cpp
.. ~20 .cpp files
myprog.cpp
In my Makefile I compile all boost-regex .cp...
Hi All,
We are using boost::interprocess::managed_shared_memory. Recently while testing we found that after process crash threads searching in shared memory got stuck in manage_shared_memory APIs.
My initial observation is that m_header recursive lock which is member of segment_manager was in locked state while process crashed and res...
As my prveious question sounded confusing, I think it's best to clearly state what I want to achieve.
I have (ignore the inheritance for now and focus on X):
class Base {};
class X : public Base {
private:
double m_double;
public:
template<class A> friend
void state( A& a, const X& x ) {
data( a, x.m_double, "m_do...
I have a code that has been working for almost 4 years (since boost 1.33) and today I went from boost 1.36 to boost 1.42 and now I have a problem.
I'm calling a custom formatter on a string to format parts of the string that match a REGEX.
For instance, a string like: "abc;def:" will be changed to "abc\2Cdef\3B" if the REGEX contains "...
Upon including <boost/thread.hpp> I get this exception:
First-chance exception at 0x7c812afb in CSF.exe: Microsoft C++ exception:
boost::exception_detail::clone_impl<boost::exception_detail::bad_alloc_> at memory location 0x0012fc3c..
First-chance exception at 0x7c812afb in CSF.exe: Microsoft C++ exception: [rethrow] at memory locati...
If I have user defined exceptions in my code, I can't get Boost test
to consider them as failures.
For example,
BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(MyTest,1)
BOOST_AUTO_TEST_CASE(MyTest)
{
// code which throws user defined exception, not derived from std::exception.
}
I get a generic message:
Caught exception: ....
unknown locat...
I'm using the boost mt19937 implementation for a simulation.
The simulation needs to be reproducible, and that means storing and potentially reusing the RNG seeds later. I'm using the windows crypto api to generate the seed values because I need an external source for the seeds and not because of any particular guarantees of randomness...
Hello, I have a ptr_vector list of my own objects. Something like this:
boost::ptr_vector<SomeClass> *list;
list->push_back(new SomeClass()>;
...
BOOST_FOREACH(SomeClass *tempObj, list) // [x]
{
tempObj->...
}
>‘boost::ptr_vector<SomeClass>*’ is not a class, struct, or union type
...
Hi guys!
I have some abstract class called IClass (has pure virtual function). There are some classes which inherit IClass: CFirst, CSecond.
I want to add objects of classes which inherit into boost::ptr_vector:
class IClass { virtual void someFunc() = 0; };
class CFirst : public IClass { };
class CSecond : public IClass { };
boost::pt...
Why won't this compile?
#include <functional>
#include <boost/function.hpp>
class A {
A() {
typedef boost::function<void ()> FunctionCall;
FunctionCall f = std::bind1st(std::mem_fun(&A::process), this);
}
void process() {}
};
Errors:
In file included from /opt/local/include/gcc44/c++/bits/stl_func...
I am so frustrated right now after several hours trying to find where shared_ptr is located. None of the examples I see show complete code to include the headers for shared_ptr (and working). Simply stating std, tr1 and <memory> is not helping at all! I have downloaded boosts and all but still it doesn't show up! Can someone help me by ...
I have a loop which should be nicely pararellized by insering one openmp pragma:
boost::normal_distribution<double> ddist(0, pow(retention, i - 1));
boost::variate_generator<gen &, BOOST_TYPEOF(ddist)> dgen(rng, ddist);
// Diamond
const std::uint_fast32_t dno = 1 <<...
Is there any WinAPI WinExec analog in boost (c++) libraries? I need to run executable from my program, and pass parameters to it. Should I use any other cross-platform libraries for this, or handle myself what OS my program is compiled for?
...
I recently saw that the boost program_options library throws a logic_error if the command-line input was un-parsable. That challenged my assumptions about logic_error vs. runtime_error.
I assumed that logic errors (logic_error and its derived classes) were problems that resulted from internal failures to adhere to program invariants,...
#include <iostream>
#include <boost/thread.hpp>
using std::endl; using std::cout;
using namespace boost;
mutex running_mutex;
struct dostuff
{
volatile bool running;
dostuff() : running(true) {}
void operator()(int x)
{
cout << "dostuff beginning " << x << endl;
this_thread::sleep(posix_time::seconds(2)...
hi.
this code:
boost::filesystem::is_directory("/usr/include");
work fine.
both this code:
boost::filesystem::is_directory(L"/usr/include");
throw an exception:
terminate called after throwing an
instance of 'std::runtime_error'
what():
locale::facet::_S_create_c_locale name
not valid
OS - Linux Mint
boost-1.43
gc...
My application problem is the following -
I have a large structure foo. Because these are large and for memory management reasons, we do not wish to delete them when processing on the data is complete.
We are storing them in std::vector<boost::shared_ptr<foo>>.
My question is related to knowing when all processing is complete. Fir...
Hi there,
I'm trying to write a container class using boost::ptr_vector. Inside the ptr_vector I would like to include different classes. I'm trying to achieve that using static templates, but so far I'm not able to do that. For example, the container class is
class model {
private:
boost::ptr_vector<elem_type> elements;
public:
vo...
This is really annoying me as I have done it before, about a year ago and I cannot for the life of me remember what library it was.
Basically, the problem is that I want to be able to call a method a certain number of times or for a certain period of time at a specified interval.
One example would be I would like to call a method "x" s...