/*============================================================================= Copyright (c) 2001-2011 Joel de Guzman http://spirit.sourceforge.net/ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef BOOST_SPIRIT_MAKE_CONS_OCTOBER_16_2008_1252PM #define BOOST_SPIRIT_MAKE_CONS_OCTOBER_16_2008_1252PM #if defined(_MSC_VER) #pragma once #endif #include // needs to be included before proto #include #include #include #include #include #include #include #include namespace boost { namespace spirit { namespace detail { template struct as_meta_element : mpl::eval_if_c::value || is_function::value , add_reference, remove_const > {}; template struct as_meta_element : as_meta_element // always store by value {}; template struct as_meta_element { typedef const T(&type)[N]; }; namespace result_of { template struct make_cons { typedef typename as_meta_element::type car_type; typedef typename fusion::cons type; }; } template fusion::cons::type, Cdr> make_cons(Car const& car, Cdr const& cdr) { typedef typename as_meta_element::type car_type; typedef typename fusion::cons result; return result(car, cdr); } template fusion::cons::type> make_cons(Car const& car) { typedef typename as_meta_element::type car_type; typedef typename fusion::cons result; return result(car); } #if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 0) // workaround for gcc-4.0 bug where illegal function types // can be formed (const is added to function type) // description: http://lists.boost.org/Archives/boost/2009/04/150743.php template fusion::cons::type> make_cons(Car& car, typename enable_if >::type* = 0) { typedef typename as_meta_element::type car_type; typedef typename fusion::cons result; return result(car); } #endif }}} #endif