Boost logo

Boost Users :

Subject: [Boost-users] boost::interprocess managed_unique_ptr cannot be used inside template (VS2008).
From: bear330 (blp330_at_[hidden])
Date: 2012-03-21 04:21:43


Hi,

I eagerly want to try boost 1.49, but the compiler error stuck me.

managed_unique_ptr cannot be used inside template if I use Visual Studio
2008:

There is a very simple example:

#include <iostream>

#include <boost/interprocess/managed_windows_shared_memory.hpp>

#include <boost/interprocess/smart_ptr/unique_ptr.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/containers/list.hpp>
#include <boost/interprocess/sync/named_mutex.hpp>
#include <boost/interprocess/sync/named_condition.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp>

struct Request
{
 int a;
};

template<typename Segment, typename T>
class Channel
{
public:

 /// Value pointer in queue.
 typedef typename boost::interprocess::managed_unique_ptr<T, Segment>::type
  ValuePtr;

};

int main(int argc, char* argv[])
{
 Channel<boost::interprocess::managed_windows_shared_memory,
Request>::ValuePtr v;
 
 std::cout << "Test" << std::endl;
 
 return 0;
}

I got this error in Visual Studio 2008:

T.cpp
C:\Program
Files\boost\boost_1_49_0\boost/interprocess/detail/pointer_type.hpp(64) :
error C2039: 'remove_reference' : is not a member of
'boost::interprocess::ipcdetail::ipcdetail'
        C:\Program
Files\boost\boost_1_49_0\boost/interprocess/smart_ptr/unique_ptr.hpp(94) :
see reference to class template instantiation
'boost::interprocess::ipcdetail::pointer_type<T,D>' being compiled
        with
        [
            T=Request,
           
D=boost::interprocess::deleter<Request,boost::interprocess::segment_manager&lt;char,boost::interprocess::rbtree_best_fit&lt;boost::interprocess::mutex_family>,boost::interprocess::iset_index>>
        ]
        T.cpp(34) : see reference to class template instantiation
'boost::interprocess::unique_ptr<T,D>' being compiled
        with
        [
            T=Request,
           
D=boost::interprocess::deleter<Request,boost::interprocess::segment_manager&lt;char,boost::interprocess::rbtree_best_fit&lt;boost::interprocess::mutex_family>,boost::interprocess::iset_index>>
        ]
C:\Program
Files\boost\boost_1_49_0\boost/interprocess/detail/pointer_type.hpp(64) :
error C2947: expecting '>' to terminate template-argument-list, found '<'
C:\Program
Files\boost\boost_1_49_0\boost/interprocess/detail/pointer_type.hpp(64) :
error C3203: 'remove_reference' : unspecialized class template can't be used
as a template argument for template parameter 'D', expected a real type
C:\Program
Files\boost\boost_1_49_0\boost/interprocess/detail/pointer_type.hpp(64) :
error C2955: 'boost::interprocess::ipcdetail::remove_reference' : use of
class template requires template argument list
        C:\Program
Files\boost\boost_1_49_0\boost/interprocess/detail/type_traits.hpp(30) : see
declaration of 'boost::interprocess::ipcdetail::remove_reference'
C:\Program
Files\boost\boost_1_49_0\boost/interprocess/detail/pointer_type.hpp(64) :
error C2143: syntax error : missing ';' before '>'
C:\Program
Files\boost\boost_1_49_0\boost/interprocess/detail/pointer_type.hpp(64) :
error C2039: 'type' : is not a member of '`global namespace''
C:\Program
Files\boost\boost_1_49_0\boost/interprocess/detail/pointer_type.hpp(64) :
error C2039: 'type' : is not a member of '`global namespace''
C:\Program
Files\boost\boost_1_49_0\boost/interprocess/detail/pointer_type.hpp(64) :
error C2238: unexpected token(s) preceding ';'
C:\Program
Files\boost\boost_1_49_0\boost/interprocess/smart_ptr/unique_ptr.hpp(94) :
error C2039: 'type' : is not a member of
'boost::interprocess::ipcdetail::pointer_type<T,D>'
................

This example works fine in boost 1.48.0

I submit a ticket ( https://svn.boost.org/trac/boost/ticket/6648 #6648 ) to
boost::interprocess, but no any reply since 3 weeks ago,
So I just ask how to solve this problem or any direction?

Thanks.

--
View this message in context: http://boost.2283326.n4.nabble.com/boost-interprocess-managed-unique-ptr-cannot-be-used-inside-template-VS2008-tp4491578p4491578.html
Sent from the Boost - Users mailing list archive at Nabble.com.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net