Chris@16: // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. Chris@16: // Use, modification and distribution are subject to the Boost Software License, Chris@16: // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt). Chris@16: // Chris@16: // See http://www.boost.org/libs/utility for most recent version including documentation. Chris@16: Chris@16: // call_traits: defines typedefs for function usage Chris@16: // (see libs/utility/call_traits.htm) Chris@16: Chris@16: /* Release notes: Chris@16: 23rd July 2000: Chris@16: Fixed array specialization. (JM) Chris@16: Added Borland specific fixes for reference types Chris@16: (issue raised by Steve Cleary). Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_DETAIL_CALL_TRAITS_HPP Chris@16: #define BOOST_DETAIL_CALL_TRAITS_HPP Chris@16: Chris@16: #ifndef BOOST_CONFIG_HPP Chris@16: #include Chris@16: #endif Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost{ Chris@16: Chris@16: namespace detail{ Chris@16: Chris@16: template Chris@16: struct ct_imp2 Chris@16: { Chris@16: typedef const T& param_type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct ct_imp2 Chris@16: { Chris@16: typedef const T param_type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct ct_imp Chris@16: { Chris@16: typedef const T& param_type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct ct_imp Chris@16: { Chris@16: typedef typename ct_imp2::param_type param_type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct ct_imp Chris@16: { Chris@16: typedef typename ct_imp2::param_type param_type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct ct_imp Chris@16: { Chris@16: typedef const T param_type; Chris@16: }; Chris@16: Chris@16: } Chris@16: Chris@16: template Chris@16: struct call_traits Chris@16: { Chris@16: public: Chris@16: typedef T value_type; Chris@16: typedef T& reference; Chris@16: typedef const T& const_reference; Chris@16: // Chris@16: // C++ Builder workaround: we should be able to define a compile time Chris@16: // constant and pass that as a single template parameter to ct_imp, Chris@16: // however compiler bugs prevent this - instead pass three bool's to Chris@16: // ct_imp and add an extra partial specialisation Chris@16: // of ct_imp to handle the logic. (JM) Chris@16: typedef typename boost::detail::ct_imp< Chris@16: T, Chris@16: ::boost::is_pointer::value, Chris@16: ::boost::is_arithmetic::value, Chris@16: ::boost::is_enum::value Chris@16: >::param_type param_type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct call_traits Chris@16: { Chris@16: typedef T& value_type; Chris@16: typedef T& reference; Chris@16: typedef const T& const_reference; Chris@16: typedef T& param_type; // hh removed const Chris@16: }; Chris@16: Chris@16: #if BOOST_WORKAROUND( __BORLANDC__, < 0x5A0 ) Chris@16: // these are illegal specialisations; cv-qualifies applied to Chris@16: // references have no effect according to [8.3.2p1], Chris@16: // C++ Builder requires them though as it treats cv-qualified Chris@16: // references as distinct types... Chris@16: template Chris@16: struct call_traits Chris@16: { Chris@16: typedef T& value_type; Chris@16: typedef T& reference; Chris@16: typedef const T& const_reference; Chris@16: typedef T& param_type; // hh removed const Chris@16: }; Chris@16: template Chris@16: struct call_traits Chris@16: { Chris@16: typedef T& value_type; Chris@16: typedef T& reference; Chris@16: typedef const T& const_reference; Chris@16: typedef T& param_type; // hh removed const Chris@16: }; Chris@16: template Chris@16: struct call_traits Chris@16: { Chris@16: typedef T& value_type; Chris@16: typedef T& reference; Chris@16: typedef const T& const_reference; Chris@16: typedef T& param_type; // hh removed const Chris@16: }; Chris@16: Chris@16: template Chris@16: struct call_traits< T * > Chris@16: { Chris@16: typedef T * value_type; Chris@16: typedef T * & reference; Chris@16: typedef T * const & const_reference; Chris@16: typedef T * const param_type; // hh removed const Chris@16: }; Chris@16: #endif Chris@16: #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) Chris@16: template Chris@16: struct call_traits Chris@16: { Chris@16: private: Chris@16: typedef T array_type[N]; Chris@16: public: Chris@16: // degrades array to pointer: Chris@16: typedef const T* value_type; Chris@16: typedef array_type& reference; Chris@16: typedef const array_type& const_reference; Chris@16: typedef const T* const param_type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct call_traits Chris@16: { Chris@16: private: Chris@16: typedef const T array_type[N]; Chris@16: public: Chris@16: // degrades array to pointer: Chris@16: typedef const T* value_type; Chris@16: typedef array_type& reference; Chris@16: typedef const array_type& const_reference; Chris@16: typedef const T* const param_type; Chris@16: }; Chris@16: #endif Chris@16: Chris@16: } Chris@16: Chris@16: #endif // BOOST_DETAIL_CALL_TRAITS_HPP