Chris@16: /*============================================================================= Chris@16: Copyright (c) 2007 Tobias Schwinger Chris@16: Chris@16: Use modification and distribution are subject to the Boost Software Chris@16: License, 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: Chris@16: #if !defined(BOOST_FUSION_SUPPORT_DEDUCE_HPP_INCLUDED) Chris@16: #define BOOST_FUSION_SUPPORT_DEDUCE_HPP_INCLUDED Chris@16: Chris@101: #include Chris@16: #include Chris@16: Chris@101: #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL Chris@101: #include Chris@101: #endif Chris@101: Chris@16: namespace boost { namespace fusion { namespace traits Chris@16: { Chris@16: template struct deduce; Chris@16: Chris@16: //----- ---- --- -- - - - - Chris@16: Chris@16: // Non-references pass unchanged Chris@16: Chris@16: template Chris@16: struct deduce Chris@16: { Chris@16: typedef T type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct deduce Chris@16: { Chris@16: typedef T type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct deduce Chris@16: { Chris@16: typedef T type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct deduce Chris@16: { Chris@16: typedef T type; Chris@16: }; Chris@16: Chris@16: // Keep references on mutable LValues Chris@16: Chris@16: template Chris@16: struct deduce Chris@16: { Chris@16: typedef T & type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct deduce Chris@16: { Chris@16: typedef T volatile& type; Chris@16: }; Chris@16: Chris@16: // Store away potential RValues Chris@16: Chris@16: template Chris@16: struct deduce Chris@16: { Chris@16: typedef T type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct deduce Chris@16: { Chris@16: typedef T type; Chris@16: }; Chris@16: Chris@16: // Unwrap Boost.RefS (referencee cv is deduced) Chris@16: Chris@16: template Chris@16: struct deduce & > Chris@16: { Chris@16: typedef T& type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct deduce const & > Chris@16: { Chris@16: typedef T& type; Chris@16: }; Chris@16: Chris@101: // Also unwrap C++11 std::ref if available (referencee cv is deduced) Chris@101: #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL Chris@101: template Chris@101: struct deduce &> Chris@101: { Chris@101: typedef T& type; Chris@101: }; Chris@101: Chris@101: template Chris@101: struct deduce const &> Chris@101: { Chris@101: typedef T& type; Chris@101: }; Chris@101: #endif Chris@101: Chris@16: // Keep references on arrays, even if const Chris@16: Chris@16: template Chris@16: struct deduce Chris@16: { Chris@16: typedef T(&type)[N]; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct deduce Chris@16: { Chris@16: typedef volatile T(&type)[N]; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct deduce Chris@16: { Chris@16: typedef const T(&type)[N]; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct deduce Chris@16: { Chris@16: typedef const volatile T(&type)[N]; Chris@16: }; Chris@16: Chris@16: }}} Chris@16: Chris@16: #endif Chris@16: