Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:47:35

0001 //  Copyright (c) 2001-2011 Hartmut Kaiser
0002 //
0003 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
0004 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #if !defined(BOOST_SPIRIT_KARMA_AS_STRING_DEC_18_0644PM)
0007 #define BOOST_SPIRIT_KARMA_AS_STRING_DEC_18_0644PM
0008 
0009 #if defined(_MSC_VER)
0010 #pragma once
0011 #endif
0012 
0013 #include <boost/spirit/home/support/unused.hpp>
0014 #include <boost/spirit/home/support/attributes_fwd.hpp>
0015 
0016 ///////////////////////////////////////////////////////////////////////////////
0017 namespace boost { namespace spirit { namespace traits
0018 {
0019     ///////////////////////////////////////////////////////////////////////////
0020     //  This file contains the attribute to string conversion utility. The 
0021     //  utility provided also accept spirit's unused_type; all no-ops. Compiler 
0022     //  optimization will easily strip these away.
0023     ///////////////////////////////////////////////////////////////////////////
0024 
0025     ///////////////////////////////////////////////////////////////////////////
0026     template <typename T, typename Attribute>
0027     inline typename spirit::result_of::attribute_as<T, Attribute>::type
0028     as(Attribute const& attr)
0029     {
0030         return attribute_as<T, Attribute>::call(attr);
0031     }
0032 
0033     template <typename T>
0034     inline unused_type as(unused_type)
0035     {
0036         return unused;
0037     }
0038     
0039     ///////////////////////////////////////////////////////////////////////////
0040     template <typename T, typename Attribute>
0041     inline bool valid_as(Attribute const& attr)
0042     {
0043         return attribute_as<T, Attribute>::is_valid(attr);
0044     }
0045 
0046     template <typename T>
0047     inline bool valid_as(unused_type)
0048     {
0049         return true;
0050     }
0051 }}}
0052 
0053 ///////////////////////////////////////////////////////////////////////////////
0054 namespace boost { namespace spirit { namespace result_of
0055 {
0056     template <typename T, typename Attribute>
0057     struct attribute_as
0058       : traits::attribute_as<T, Attribute>
0059     {};
0060 
0061     template <typename T>
0062     struct attribute_as<T, unused_type>
0063     {
0064         typedef unused_type type;
0065     };
0066 
0067     template <typename T>
0068     struct attribute_as<T, unused_type const>
0069     {
0070         typedef unused_type type;
0071     };
0072 }}}
0073 
0074 #endif