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