// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. // Permission to copy, use, modify, sell and // distribute this software is granted provided this copyright notice appears // in all copies. This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // See http://www.boost.org for most recent version including documentation. // call_traits: defines typedefs for function usage // (see libs/utility/call_traits.htm) /* Release notes: 23rd July 2000: Fixed array specialization. (JM) Added Borland specific fixes for reference types (issue raised by Steve Cleary). */ #ifndef BOOST_DETAIL_CALL_TRAITS_HPP #define BOOST_DETAIL_CALL_TRAITS_HPP #ifndef BOOST_CONFIG_HPP #include #endif #ifndef BOOST_ARITHMETIC_TYPE_TRAITS_HPP #include #endif #ifndef BOOST_COMPOSITE_TYPE_TRAITS_HPP #include #endif namespace boost{ namespace detail{ template struct ct_imp { typedef const T& param_type; }; template struct ct_imp { typedef T const param_type; }; template struct ct_imp { typedef T const param_type; }; } template struct call_traits { public: typedef T value_type; typedef T& reference; typedef const T& const_reference; // // C++ Builder workaround: we should be able to define a compile time // constant and pass that as a single template parameter to ct_imp, // however compiler bugs prevent this - instead pass three bool's to // ct_imp and add an extra partial specialisation // of ct_imp to handle the logic. (JM) typedef typename detail::ct_imp::type>::value, ::boost::is_arithmetic::type>::value, sizeof(T) <= sizeof(void*)>::param_type param_type; }; template struct call_traits { typedef T& value_type; typedef T& reference; typedef const T& const_reference; typedef T& param_type; // hh removed const }; #if defined(__BORLANDC__) && (__BORLANDC__ <= 0x551) // these are illegal specialisations; cv-qualifies applied to // references have no effect according to [8.3.2p1], // C++ Builder requires them though as it treats cv-qualified // references as distinct types... template struct call_traits { typedef T& value_type; typedef T& reference; typedef const T& const_reference; typedef T& param_type; // hh removed const }; template struct call_traits { typedef T& value_type; typedef T& reference; typedef const T& const_reference; typedef T& param_type; // hh removed const }; template struct call_traits { typedef T& value_type; typedef T& reference; typedef const T& const_reference; typedef T& param_type; // hh removed const }; #endif template struct call_traits { private: typedef T array_type[N]; public: // degrades array to pointer: typedef const T* value_type; typedef array_type& reference; typedef const array_type& const_reference; typedef const T* const param_type; }; template struct call_traits { private: typedef const T array_type[N]; public: // degrades array to pointer: typedef const T* value_type; typedef array_type& reference; typedef const array_type& const_reference; typedef const T* const param_type; }; } #endif // BOOST_DETAIL_CALL_TRAITS_HPP