Hey,
what is the best way to concatenate 2 bitsets?
For example i've got
boost::dynamic_bitset<> test1( std::string("1111") );
boost::dynamic_bitset<> test2( std::string("00") );
they should be concatenated into a thrid Bitset test3 which then holds
111100
Solutions should use boost::dynamic_bitset. If the solution works with st...
Hi,
I'm trying to figure out how asynchronous reads and writes work in boost asio by manipulating the echo example. Currently, I have a server that should, when sent a sentence, respond with only the first word. However, the boost::asio::async_write never seems to complete even though the write handler is being called. Can someone pl...
Hello, how can I insert my own class objects into ptr_map from boost. The objects are templated so I can't use some static typename in the map. So I did:
ptr_map<string, any> someMap;
My class inherits the boost::noncopyable.
someMap.insert("Test", new MyClass<SomeTemplate>());
The error is: error: no matching function for call to ...
My client application uses a boost::asio::ip::tcp::socket to connect to a remote server.
If the app loses connection to this server (e.g. due to the server crashing or being shutdown) I would like it to attempt a re-connect at regular intervals until it succeeds.
What do I need to do on the client-side to cleanly handle a disconnect, ti...
If my command line is:
> prog --mylist=a,b,c
Can Boost's program_options be setup to see three distinct argument values for the mylist argument? I have configured program_options as:
namespace po = boost::program_options;
po::options_description opts("blah")
opts.add_options()
("mylist", std::vector<std::string>>()->multitoken, ...
Hi SOF,
I have this program which uses Boost::Asio for sockets. I pretty much altered some code from the Boost examples. The program compiles and runs just like it should on Windows in VS. However, when I compile the program on Linux and run it, I get a Segmentation fault.
I posted the code here
The command I use to compile it is this...
Boost.Asio documentation suggests the following exception handling pattern:
boost::asio::io_service io_service;
...
for (;;)
{
try
{
io_service.run();
break; // run() exited normally
}
catch (my_exception& e)
{
// Deal with exception as appropriate.
}
}
The problem with it is that the context of exception is lo...
I stumbled upon multi_index on a lark last night while pounding my had against a collection that I need to access by 3 different key values, and also to have rebalancing array semantics. Well I got one of my two wishes (3 different key values) in boost::multi_index.
I'm curious if anything similar exists in the Java world.
...
Hello, I have some predefined type which inherits boost::noncopyable (so I have to store the pointer at these objects). I use a boost::ptr_map. As I know, the second argument in it is already a pointer. So, the code:
ptr_map<string, boost::any> SomeMap;
typedef %Some noncopyable class/signature% NewType;
// Inserting now
boost::any *te...
I recently came across the need to sleep the current thread for an exact period of time. I know of two methods of doing so on a POSIX platform: using nanosleep() or using Boost::this_thread::sleep().
Out of curiosity more than anything else, I was wondering what the differences are between the two approaches. Is there any difference i...
I'm trying to build a class that eases the use of the boost boost::numeric::ublas::matrix. Thus I've got:
using namespace boost::numeric::ublas;
typedef matrix<double> matrix_t;
class Tensor : public matrix_t {
public:
Tensor (const int M, const int N) : matrix_t(M, N) { }
virtual ~Tensor() { }
Tensor SubMatrix (const...
Hello, I'm packing some classes into ptr_map with any typed value.
class EventManager
{
ptr_map<string, any> mSomeMap;
public:
typedef signals2::signal<void (int someSignature)> KeyEvent;
EventManager()
{
mSomeMap["KeyPressed"] = new any(new KeyEvent());
}
};
Now I want to restore my signal objec...
Any chance to use enable_if with a type conversion operator? Seems tricky, since both return type and parameters list are implicit.
...
I particularly like the simplicity of using STL containers in the straightforward way.
I have never really figured out how to get the Boost library working on my dev platforms, in fact I don't think I've even tried. I guess you could say I am just trying to delay the inevitable since Boost is clearly a helpful library that I should be ...
struct A
{
std::string get_string();
};
struct B
{
int value;
};
typedef boost::variant<A,B> var_types;
std::vector<var_types> v;
A a;
B b;
v.push_back(a);
v.push_back(b);
How can I iterate iterate through the elements of v to get access to the a and b objects ?
I'm able to do it with boost::get b...
quite new to boost and asio, need help
connect to proxy
asio::ip::tcp::socket socket_;
send CONNECT host: ssl server to the proxy
receive response 200
asio::ssl::context ctx(io_service, asio::ssl::context::sslv23);
sslsocket_(socket_,context)
try handshake
sslsocket_.async_handshake(asio::ssl::stream_base::client,
boost::bind(&clien...
I have wondered about this on and off but I never really got a definite answer. Is it possible within the boost.python framework to link against another boost.python module.
For example I have exported class A within boost_python_module(libA) and function B(A a) within boost_python_module(libB). Is it possible to specify in libB to lin...
hi,
I have just been working with boost::bind and boost::function and noticed the following behaviour (which I thought was a bit odd). You can bind a function with fewer parameters than required by the boost::function type! It appears as though any additional parameters are simply ignored and just fall away.
So why is this behaviour co...
I'm looking to replace a homebrew "logging" library with something more powerful/portable.
I've found John Torjo's "Boost Logging library", but it seems to have been rejected as part of Boost, which is a little disconcerting. What other options are available?
...
I'm having a look at the Boost libraries that were included in C++'s Technical Report 1 and trying to understand what each does.
I've just finished running an example for boost::mem_fn and now I'm wondering what's the point of using it instead of the better boost::bind. As far as I understand, both of them return a function object poin...