Here is a boost example:
typedef boost::multi_array<double, 1> array_type;
typedef array_type::index index;
array_type A(boost::extents[100]);
for(index i = 0; i != A.size(); ++i) {
A[i] = (double)i;
}
// creating view
array_type::index_gen indices;
typedef boost::multi_array_types::index_range range;
array_...
Hey,
I've been attempting to write a client/server app with boost now, so far it sends and receives but I can't seem to just read X bytes into a vector.
If I use the following code
vector<uint8_t> buf;
for (;;)
{
buf.resize(4);
boost::system::error_code error;
size_t len = socket.read_some(boost::asio::buffer(buf), error);
if ...
Assume that I have a boost::function of with an arbitrary signature called type CallbackType.
Is it possible to use boost::bind to compose a function that takes the same arguments as the CallbackType but calls the two functors in succession?
I'm open to any potential solution, but here's a...
...Hypothetical example using some magi...
When a Client serializes the following data:
InternationalStudent student;
student.id("Client ID");
student.firstName("Client First Name");
student.country("Client Country");
the Server receives the following:
ID = "Client ID"
Country = "Client First Name"
instead of the following:
ID = "Client ID"
Country = "Client Country"
The...
hello.
I look in documentation and source code but cannot figure out how to get return value type of boost bind functor.
I am trying to accomplish following:
35 template<typename T,size_t N, class F>
36 boost::array<typename F::value_type, N> make_array(T (&input)[N], F unary) {
37 boost::array<typename F::value_type, N> array;
...
Like this question already asked, I'd like to initialize a container using STL where the elements are hard-coded in the cleanest manner possible. In this case, the elements are a doubly nested container:
set<vector<int> > A;
And I'd like (for example) to put the following values in:
A = [[0,0,1],[0,1,0],[1,0,0],[0,0,0]];
C++0x fine...
I'm wondering about Nvidia's CUBLAS Library. Does anybody have experience with it? For example if I write a C program using BLAS will I be able to replace the calls to BLAS with calls to CUBLAS? Or even better implement a mechanism which let's the user choose at runtime?
What about if I use the BLAS Library provided by Boost with C++?
...
I want to have two options for the program to work on, the start address and end address so that the program options are as follows:
--start_address 0xc0000000 --end_address 0xffffffff
Is it possible for options_description to take such hex input? Do I have to consider the input as string and convert them to hex values. I have this at...
I would like to call a member through lambda::bind. Unfortunately I have got two members with the same name but different return types.
Is there a way to help the lambda::bind to deduce the right return type for a member function call? (bind works fine with explicit return type deduction)
#include <vector>
#include <iostream>
#include <...
hello.
I know I can do this y[i] += f(x[i]) using transform with two input iterators.
however it seems somewhat counterintuitive and more complicated than for loop.
Is there a more natural way to do so using existing algorithm in boost or Stl. I could not find clean equivalent.
here is transform (y = y + a*x):
using boost::lambda;
t...
Hey,
I've been working on an async boost server program, and so far I've got it to connect. However I'm now getting a "Vector iterator not dereferencable" error.
I suspect the vector gets destroyed or dereferenced before he packet gets sent thus causing the error.
void start()
{
Packet packet;
packet.setOpcode(SMSG_PING);
...
I'm currently designing a object structure for a game, and the most natural organization in my case became a tree. Being a great fan of smart pointers I use shared_ptr's exclusively. However, in this case, the children in the tree will need access to it's parent (example -- beings on map need to be able to access map data -- ergo the dat...
I have an std::map, and I would like to define an iterator that returns modified values. Typically, a std::map<int,double>::iterator iterates over std::pair<int,double>, and I would like the same behavior, just the double value is multiplied by a constant.
I tried it with boost::transform_iterator, but it doesn't compile:
#include <ma...
I'm looking for independent implementation of boost/tr1 shared_ptr, weak_ptr and enable_shared_from_this.
I need:
Boost independent very small implementation of these features.
I need support of only modern compilers like GCC-4.x, MSVC-2008, Intel not things like MSVC6 or gcc-3.3
I need it to be licensed under non-copyleft LGPL compa...
Hi,
I don't like to use <iostream> in C++ Library. I prefer to use something that is similar to "printf" and "scanf" in <stdio.h>.
Can I use Boost's format library to replace <iostream> in all my C++ program ?
...
I'm looking at boost::lambda as a way to to make a generic algorithm that can work with any "getter" method of any class.
The algorithm is used to detect duplicate values of a property, and I would like for it to work for any property of any class.
In C#, I would do something like this:
class Dummy
{
public String GetId() ...
...
C++0x thread library or Boost.thread define non-member variadic template function that lock all lock avoiding dead lock.
template <class L1, class L2, class... L3> void lock(L1&, L2&, L3&...);
While this function avoid help to deadlock, the standard do not includes the associated scoped lock to write exception safe code.
{
std::l...
Hi,
I am trying to compile the latest Boost c++ libraries for Centos. I 've used bjam install and it has placed the libraries in /usr/lib and /usr/lib64.
The problem is I need the -mt variants for a specific application to run. I cannot understand in the documentation how to create the multithreading variants. :(
Please give me a hint...
C++0x allows to lock on a mutex until a given time is reached, and return a boolean stating if the mutex has been locked or not.
template <class Clock, class Duration>
bool try_lock_until(const chrono::time_point<Clock,
Duration>& abs_time);
In some contexts, I consider an exceptional situation that the locking fa...
C++0x thread library or Boost.thread define a non-member variadic template function that locks all mutex at once that helps to avoid deadlock.
template <class L1, class L2, class... L3>
void lock(L1&, L2&, L3&...);
The same can be applied to a non-member variadic template function try_lock_until, which locks all the mutex until a giv...