Guys, I am using dynamic programming approach to solve a problem. Here is a brief overview of the approach
Each value generated is identified using 25 unique keys.
I use the boost::hash_combine to generate the seed for the hash table using these 25 keys.
I store the values in a hash table declared as
boost::unordered_map<Key_Object,...
I am trying to pass data around the numpy and boost::ublas layers. I
have written an ultra thin wrapper because swig cannot parse ublas'
header correctly. The code is shown below
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/lexical_cast.hpp>
#include <algorithm>
#include <sstream>
#...
I remember encountering this concept before, but can't find it in Google now.
If I have an object of type A, which directly embeds an object of type B:
class A {
B b;
};
How can I have a smart pointer to B, e. g. boost::shared_ptr<B>, but use reference count of A? Assume an instance of A itself is heap-allocated I can safely get ...
It seem that the only implementation that provide Safe Cross-Thread Signals for both the Signal class and what's being called in the slot is QT. (Maybe I'm wrong?).
But I cannot use QT in the project I'm doing. So how could I provide safe Slots call from a different thread (Using Boost::signals2 for example)? Are mutex inside the slot ...
I have a really simple question, yet I can't find an answer for it. I guess I am missing something in the usage of the boost timer.hpp. Here is my code, that unfortunately gives me an error message:
#include <boost/timer.hpp>
int main() {
boost::timer t;
}
And the error messages are as follows:
/usr/include/boost/timer.hpp: In m...
I know that boost.asio has a mechanism that calls a callback function whenever a packet is received but is there an option to emit a signal instead?
Do I have to write a function that emits the signal?
If it is so, why?
...
I was going over the examples of boost.asio and I am wondering why there isn't an example of a simple server/client example that prints a string on the server and then returns a response to the client.
I tried to modify the echo server but I can't really figure out what I'm doing at all.
Can anyone find me a template of a client and a te...
I've been struggling to try and (incrementally) modify example code from the documentation but with not much different I am not getting the behavior I expect. Specifically, the "if" statement fails when (my intent is that) it should be passing (there was an "else" but that part of the parser was removed during debugging). The assignmen...
My program appears to run just fine most of the time, but occasionally I get a segmentation fault.
boost version = 1.41.0
running on RHEL 4
compiled with GCC 3.4.6
Backtrace:
#0 0x08138546 in boost::asio::detail::posix_fd_set_adapter::is_set (this=0xb74ed020, descriptor=-1)
at /home/scottl/boost_1_41_0/boost/asio/detail/posix_f...
Under Windows the only way to get Unicode support is to use wchar_t (UTF-16 under Windows) instead of char.
The problem is that I found that at least one of the boost libraries (boost::program_options) doesn't support Unicode at all: you are not able to compile the examples as Unicode.
Shouldn't boost be able to compiled with wide str...
I have been messing around Boost Asio for some days now but I got stuck with this weird behavior. Please let me explain.
Computer A is sending continuos udp packets every 500 ms to computer B, computer B desires to read A's packets with it own velocity but only wants A's last packet, obviously the most updated one.
It has come to my at...
Where do I find the lib files for linking my program when using some Boost libraries?
Decided to try its threading functionality but I am getting
Error 6 fatal error LNK1104: cannot
open file
'libboost_thread-vc90-mt-gd-1_42.lib' InterviewPractice
after I include
Error 6 fatal error LNK1104: cannot
open file
'libboo...
boost/thread/pthread/shared_mutex.hpp contains this code:
...
#include <boost/thread/detail/thread_interruption.hpp>
...
class shared_mutex
{
...
void lock_shared()
{
boost::this_thread::disable_interruption do_not_disturb;
boost::mutex::scoped_lock lk(state_change);
while(state.exclusive || state.e...
Hi all,
I have a method
void foo(list<shared_ptr<Base>>& myList);
Which I'm trying to call with a two different types of lists, one of DerivedClass1 and one of DerivedClass2
list<shared_ptr<DerivedClass1>> myList1;
foo(myList1);
list<shared_ptr<DerivedClass2>> myList2;
foo(myList2);
However this obviously generates a compiler ...
Good day.
I have a Types.hpp file in my project. And within it i have:
....
namespace RC
{
.....
.....
struct ViewSettings
{
....
};
.....
}
In the Server.cpp file I'm including this Types.hpp file, and i have there:
class Session
{
.....
RC::ViewSettings tmp;
boost::asio::async_read(socket_, boost::asio::buffer(&...
Hi!
I'd like multiple threads to use the dijkstra_shortest_paths and astar_search functions of the BGL, and then read the property maps of the result vertices and edges.
I'm wondering wether I should use mutexes to ensure thread-safety.
So here are my questions:
1., Are the dijkstra_shortest_paths and astar_search functions of the Bo...
Hi, I am using the timed_wait from boost C++ library and I am getting a problem with leap seconds.
Here is a quick test:
#include <boost/thread.hpp>
#include <stdio.h>
#include <boost/date_time/posix_time/posix_time.hpp>
int main(){
// Determine the absolute time for this timer.
boost::system_time tAbsoluteTime = boost...
I would like to bind the << stream operator:
for_each(begin, end, boost::bind(&operator<<, stream, _1));
Unfortunately it does not work:
Error 1 error C2780: 'boost::_bi::bind_t<_bi::dm_result<MT::* ,A1>::type,boost::_mfi::dm<M,T>,_bi::list_av_1<A1>::type> boost::bind(M T::* ,A1)' : expects 2 arguments - 3 provided c:\source\repo...
Almost all of the examples I've gone and looked at so far from: http://boost-spirit.com/repository/applications/show_contents.php use the old syntax. I've read and re-read the actual documentation at http://www.boost.org/doc/libs/1_42_0/libs/spirit/doc/html/index.html and the examples therein. I know Joel is starting a compiler series ...
Good day.
I'm receiving a large objects via the net using boost::asio.
And I have a code:
for (int i = 1; i <= num_packets; i++)
boost::asio::async_read(socket_, boost::asio::buffer(Obj + packet_size * (i - 1), packet_size), boost::bind(...));
Where My_Class * Obj.
I'm in doubt if that approach possible (because i have a pointer t...