Whenever boost's numeric_cast<> conversion fails, it throws an exception. Is there a similar template in boost that lets me specify a default value instead, or is catching the exception the only thing I can do in this case?
I'm not too worried about the performance of all the extra exception handling, but I'd rather use a standard templ...
I have an application that creates a job queue, and then multiple threads execute the jobs. By execute them, I mean they call system() with the job string.
The problem is that output to stdout looks like the output at the bottom of the question. I would like each application run to be separated, so the output would look like:
flac 1.2...
Hey all -
I'm working through setting up a member function as a callback for a C-library that I'm using. The C-library sets up callbacks like this:
typedef int (*functionPointer_t)(myType1_t*, myType2_t*, myType3_t*);
setCallback(param1, param2, functionPointer, param4)
I would like to use boost::bind (if possible) to pass in the fu...
I wrote a small app using the Boost asio example(3) of the multi-threaded HTTP server. Periodically I get a seg fault which occurs if I ctrl-c the app. I know I must be overwriting memory somewhere, but not really sure how to debug it. The stack trace in GDB is not helpful. Are there some tools in GCC that can help me detect the corr...
Is there any tips/tricks for finding cyclic references of shared_ptr's?
This is an exmaple of what I'm trying to find - unfortunately I can't seem to find the loop in my code.
struct A
{
boost::shared_ptr<C> anC;
};
struct B
{
boost::shared_ptr<A> anA;
};
struct C
{
boost::shared_ptr<B> anB;
};
...
I'm working on a c++ project, and we recently needed to include a small part of boost in it. The boost part is really minimal (Boost::Python), thus, using bjam to build everything looks like an overkill (besides, everyone working on the project feels comfortable with make, and has no knowloedge of jam).
I made quite some tests already, ...
I have a problem with boost shared_memory_object and mapped_region. I want to write a set of objects (structures) in the memory object. If the structure contains just a char, everything is ok; if I just add an int to the structure, then if I put too many objects (let's say 70, so much less than the limit of the block) I get a segmentatio...
If the function pointer embedded in a boost::bind return object is NULL/nullptr/0, I need to take action other than calling it. How can I determine if the object contains a null function pointer?
Addenda
I don't believe I can use and compare boost::functions as the boost::bind return object is used with varying call signatures in a te...
What I need is actually a thread-safe queue structure, where multiple clients keep dumping data into the queue and one working thread keeps processing and popping the queue
is there any well-established solution existing in STL or Boost?
I now think about using Boost::threadpool to do this. Simply set the number of parallel threads to ...
I am using boost::signals2 under Red Hat Enterprise Linux 5.3.
My signal creates an object copy and sends it's pointer to subscribers. This was implemented for thread safety to prevent the worker thread from updating a string property on the object at the same time it is being read ( perhaps I should revisit the use of locks? ).
Anywa...
I'm an absolute newbie in this field and I'm kind of frightened of heading down the wrong path of network programming. I'm trying to build a strong network library for my game engine.
I've looked online and have seen there is a network library with boost, I'd love to use that as I'm really keen on further integrating it with my codebase...
I'd like to use boost::array as a class member, but I do not know the size at compile time.
I thought of something like this, but it doesn't work:
int main() {
boost::array<int, 4> array = {{1,2,3,4}};
MyClass obj(array);
}
class MyClass {
private:
boost::array<int, std::size_t> array;
public:
template<s...
I'm already experienced with C++ (C, OOP, the STL, et al.), and I'm looking to start delving into the Boost libraries. What are some common mishaps you've seen? Pitfalls you've been snagged by? Things you wish someone would have told you or pointed out?
...
Hello All,
I am using boost shared pointer from considerable time in my project. Recently my fellow team mates have also started using weak pointers. I am not able to distinguish which to use when.
Apart from this, what should I do if I want to convert weak ptr to shared ptr. Does putting a lock on weak ptr to create a shared ptr affec...
hi
I am trying to use type traits to add reference to a template parameter.
template < class T >
struct S {
typename add_reference< T >::type reference; // reference member should always be a reference
};
...
typedef Bar< Foo > type;
S< type > s; // does not add reference, S:: reference is of type type, not type&
However it does not ...
I have a very simple server/client performance test using boost::asio on Windows and it seems to be performing really poorly. I'm hoping that I'm just using the library incorrectly and would appreciate any advice.
I have a session class that writes a message-length and then writes a message, and then waits to read a message-length and ...
What is the Boost licence?
...
I have been looking into using Boost.Interprocess to create a disk-backed data structure. The examples on Boost Documentation (http://www.boost.org/doc/libs/1_41_0/doc/html/interprocess.html) are all for using shared memory even though they mention that memory mapped files can also be used. I am wondering whether anyone here has used mem...
Hi,
I've recently started using boost lambda and thought I'd try and use it in places where it will/should make things easier to read.
I have some code similar to the following
std::vector< X * > v;
for ( int i = 0 ; i < 20 ; ++i )
v.push_back( new X() );
and later on, to delete it...
std::for_each( v.begin(), v.end(), boost::l...
Is it possible to detach a native socket from Boost.ASIO's socket class? If so, how can it be done? I can't seem to find anything obvious in the documentation.
As a quick overview of what I'm trying to accomplish: I have a class that makes a connection and does some negotiation using Boost.ASIO, then passes back a native Windows SOCKET ...