Boost logo

Boost Users :

Subject: [Boost-users] Boost::Interprocess - using variadic template args with managed_shared_memory::construct()
From: james (dirtydroog_at_[hidden])
Date: 2014-04-28 06:49:39


I'm trying to write a wrapper over some of boost::interprocess and I want
to have a function like this:

template <typename T, typename... Args>
T* Wrapper::createStruct(const std::string& name, Args&&... args)
    return m_shm->construct<T>(name.c_str())(std::forward<Args>(args)...);

This fails to compile as it seems boost::interprocess uses its own varargs
scheme when I try to create
the following struct in the SHM through this wrapper function:

struct Custom
   Custom(int a, int b)
   : m_a(a),

   int a;
   int b;

int main()
   Custom* c = shm->createStruct("Custom", 1, 2);

The error message:
/usr/include/boost/interprocess/detail/named_proxy.hpp:79:7: error: no
matching function for call to
    { new((void*)mem)T(boost::forward<Args>(get<IdxPack>(args_))...); }
/usr/include/boost/interprocess/detail/named_proxy.hpp:79:7: note:
candidates are:
       Custom(int one, int two)
note: candidate expects 2 arguments, 0 provided

Is there any way I can get this to work? I'd rather my wrapper's interface
used std only.

boost 1.55
g++ 4.8.2


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at