123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- //////////////////////////////////////////////////////////////////////////////
- // (C) Copyright John Maddock 2000.
- // (C) Copyright Ion Gaztanaga 2005-2012.
- //
- // Distributed under the Boost Software License, Version 1.0.
- // (See accompanying file LICENSE_1_0.txt or copy at
- // http://www.boost.org/LICENSE_1_0.txt)
- //
- // See http://www.boost.org/libs/interprocess for documentation.
- //
- //////////////////////////////////////////////////////////////////////////////
- #ifndef BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP
- #define BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP
- #ifndef BOOST_CONFIG_HPP
- # include <boost/config.hpp>
- #endif
- #
- #if defined(BOOST_HAS_PRAGMA_ONCE)
- # pragma once
- #endif
- #include <boost/interprocess/detail/config_begin.hpp>
- namespace boost {
- namespace interprocess {
- namespace ipcdetail {
- struct nat{};
- template<class T>
- struct remove_reference
- {
- typedef T type;
- };
- template<class T>
- struct remove_reference<T&>
- {
- typedef T type;
- };
- template<class T>
- struct is_reference
- {
- static const bool value = false;
- };
- template<class T>
- struct is_reference<T&>
- {
- static const bool value = true;
- };
- template<class T>
- struct is_pointer
- {
- static const bool value = false;
- };
- template<class T>
- struct is_pointer<T*>
- {
- static const bool value = true;
- };
- template <typename T>
- struct add_reference
- {
- typedef T& type;
- };
- template<class T>
- struct add_reference<T&>
- {
- typedef T& type;
- };
- template<>
- struct add_reference<void>
- {
- typedef nat &type;
- };
- template<>
- struct add_reference<const void>
- {
- typedef const nat &type;
- };
- template <class T>
- struct add_const_reference
- { typedef const T &type; };
- template <class T>
- struct add_const_reference<T&>
- { typedef T& type; };
- template<class T>
- struct remove_const
- {
- typedef T type;
- };
- template<class T>
- struct remove_const<const T>
- {
- typedef T type;
- };
- template<class T>
- struct remove_volatile
- {
- typedef T type;
- };
- template<class T>
- struct remove_volatile<volatile T>
- {
- typedef T type;
- };
- template<class T>
- struct remove_const_volatile
- {
- typedef typename remove_const<typename remove_volatile<T>::type>::type type;
- };
- template <typename T, typename U>
- struct is_same
- {
- typedef char yes_type;
- struct no_type
- {
- char padding[8];
- };
- template <typename V>
- static yes_type is_same_tester(V*, V*);
- static no_type is_same_tester(...);
- static T *t;
- static U *u;
- static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u));
- };
- template<class T, class U>
- struct is_cv_same
- {
- static const bool value = is_same< typename remove_const_volatile<T>::type
- , typename remove_const_volatile<U>::type >::value;
- };
- } // namespace ipcdetail
- } //namespace interprocess {
- } //namespace boost {
- #include <boost/interprocess/detail/config_end.hpp>
- #endif //#ifndef BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP
|