diff options
author | Anas Nashif <anas.nashif@intel.com> | 2012-10-30 12:57:26 -0700 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2012-10-30 12:57:26 -0700 |
commit | 1a78a62555be32868418fe52f8e330c9d0f95d5a (patch) | |
tree | d3765a80e7d3b9640ec2e930743630cd6b9fce2b /boost/interprocess/detail/type_traits.hpp | |
download | boost-1a78a62555be32868418fe52f8e330c9d0f95d5a.tar.gz boost-1a78a62555be32868418fe52f8e330c9d0f95d5a.tar.bz2 boost-1a78a62555be32868418fe52f8e330c9d0f95d5a.zip |
Imported Upstream version 1.49.0upstream/1.49.0
Diffstat (limited to 'boost/interprocess/detail/type_traits.hpp')
-rw-r--r-- | boost/interprocess/detail/type_traits.hpp | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/boost/interprocess/detail/type_traits.hpp b/boost/interprocess/detail/type_traits.hpp new file mode 100644 index 0000000000..2cfa0be291 --- /dev/null +++ b/boost/interprocess/detail/type_traits.hpp @@ -0,0 +1,145 @@ +////////////////////////////////////////////////////////////////////////////// +// (C) Copyright John Maddock 2000. +// (C) Copyright Ion Gaztanaga 2005-2011. +// +// 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 + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# 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 <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)); +}; + +} // namespace ipcdetail +} //namespace interprocess { +} //namespace boost { + +#include <boost/interprocess/detail/config_end.hpp> + +#endif //#ifndef BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP |