1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2005-2012.
4 // (C) Copyright Gennaro Prota 2003 - 2004.
6 // Distributed under the Boost Software License, Version 1.0.
7 // (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
10 // See http://www.boost.org/libs/interprocess for documentation.
12 //////////////////////////////////////////////////////////////////////////////
14 #ifndef BOOST_INTERPROCESS_DETAIL_POINTER_TYPE_HPP
15 #define BOOST_INTERPROCESS_DETAIL_POINTER_TYPE_HPP
17 #ifndef BOOST_CONFIG_HPP
18 # include <boost/config.hpp>
21 #if defined(BOOST_HAS_PRAGMA_ONCE)
25 #include <boost/interprocess/detail/config_begin.hpp>
26 #include <boost/interprocess/detail/workaround.hpp>
27 #include <boost/interprocess/detail/type_traits.hpp>
30 namespace interprocess {
33 struct two {char _[2];};
35 namespace pointer_type_imp {
37 template <class U> static two test(...);
38 template <class U> static char test(typename U::pointer* = 0);
40 } //namespace pointer_type_imp {
43 struct has_pointer_type
45 static const bool value = sizeof(pointer_type_imp::test<T>(0)) == 1;
48 namespace pointer_type_imp {
50 template <class T, class D, bool = has_pointer_type<D>::value>
53 typedef typename D::pointer type;
56 template <class T, class D>
57 struct pointer_type<T, D, false>
62 } //namespace pointer_type_imp {
64 template <class T, class D>
67 typedef typename pointer_type_imp::pointer_type<T,
68 typename remove_reference<D>::type>::type type;
71 } //namespace ipcdetail {
72 } //namespace interprocess {
75 #include <boost/interprocess/detail/config_end.hpp>
77 #endif //#ifndef BOOST_INTERPROCESS_DETAIL_POINTER_TYPE_HPP