|
Ublas : |
Subject: [ublas] Special allocators
From: Dominic Amann (dominic_at_[hidden])
Date: 2010-10-28 11:49:17
I am trying ublas for simple 3d transformations, but my objects are
intended to be stored in global memory
(boost::interprocess::managed_shared_memory). It seems needlessly
complex to create a vector using a non-default allocator - it would seem
I have to initialize a vector with another (stl) vector. Is the
following correct?
namespace ipc = boot::interprocess;
namespace ublas = boost::numeric::ublas;
typedef ipc::managed_shared_memory::segment_manager segment_manager_t;
typedef ipc::allocator<double, segment_manager_t> double_allocator;
typedef ipc::vector<double, double_allocator> shm_double_vector;
typedef ublas::vector<double, shm_double_vector> XYZVector;
class MyClass {
public:
MyClass(const void_allocator& void_alloc) : _xtz_vector(4,
shm_double_vector(4, 0.0, void_alloc)) {}
private:
XYZVector _xyz_vector;
};
Where I come unstuck (I think) is in the constructor initializer? Any
help would be appreciated.