Subject: [Boost-bugs] [Boost C++ Libraries] #7654: offset_ptr can't be evaluated a pointer to a container in shared memory
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-11-06 17:53:28
#7654: offset_ptr can't be evaluated a pointer to a container in shared memory
-----------------------------------------+----------------------------------
Reporter: hongchenbo@⦠| Owner: igaztanaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.52.0 | Severity: Problem
Keywords: offset_ptr boost::container |
-----------------------------------------+----------------------------------
i created a container(boost::container::set) in shared memory by
managed_shared_memeory::construct,i wanted to put the pointer of container
into a offset_ptrï¼codes asï¼
typedef boost::container::set<int, less<int>, int_allocator_type>
values_type;
values_ptr_ = segment_manager_->construct<values_type>(
boost::interprocess::anonymous_instance )( std::less<int>(),
int_allocator_type( segment_manager_ ) );
when compilingï¼
error C2512: 'boost::interprocess::allocator<T,SegmentManager>' : no
appropriate default constructor available
with
[
T=boost::container::container_detail::rbtree_node<unsigned
__int64,boost::interprocess::offset_ptr<void>>,
SegmentManager=segment_manager_type
]
the related codes asï¼
template <class T>
offset_ptr( T *ptr
, typename ipcdetail::enable_if<
ipcdetail::is_convertible<T*, PointedType*> >::type * = 0)
{ this->set_offset(static_cast<PointedType*>(ptr)); }
template <bool B, class T = void>
struct enable_if_c {
typedef T type;
};
template <class T>
struct enable_if_c<false, T> {};
template <class Cond, class T = void>
struct enable_if : public enable_if_c<Cond::value, T> {};
template <class Cond, class T = void>
struct disable_if : public enable_if_c<!Cond::value, T> {};
template <class T, class U>
class is_convertible
{
typedef char true_t;
class false_t { char dummy[2]; };
static true_t dispatch(U);
static false_t dispatch(...);
static T trigger();
public:
static const bool value = sizeof(dispatch(trigger())) ==
sizeof(true_t);
};
i thougnt that T and U are values_type*,it's unnecessary to instantiate a
values_type,but why called allocator's constructor ï¼
the boost::container's allocator must have a default constructorï¼but,in
fact,boost::interprocess::allocator is statefulï¼its constructor need the
pointer to segment_managerãis it a bug? or my codes is fault?
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7654> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:11 UTC