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