Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:43

0001 /*=============================================================================
0002     Boost.Wave: A Standard compliant C++ preprocessor library
0003 
0004     http://www.boost.org/
0005 
0006     Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
0007     Software License, Version 1.0. (See accompanying file
0008     LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 =============================================================================*/
0010 
0011 #if !defined(BOOST_TRANSFORM_ITERATOR_HPP_D492C659_88C7_4258_8C42_192F9AE80EC0_INCLUDED)
0012 #define BOOST_TRANSFORM_ITERATOR_HPP_D492C659_88C7_4258_8C42_192F9AE80EC0_INCLUDED
0013 
0014 #include <boost/config.hpp>
0015 #include <boost/iterator_adaptors.hpp>
0016 #include <boost/iterator/transform_iterator.hpp>
0017 
0018 #include <boost/assert.hpp>
0019 
0020 // this must occur after all of the includes and before any code appears
0021 #ifdef BOOST_HAS_ABI_HEADERS
0022 #include BOOST_ABI_PREFIX
0023 #endif
0024 
0025 ///////////////////////////////////////////////////////////////////////////////
0026 namespace boost {
0027 namespace wave {
0028 namespace impl {
0029 
0030 ///////////////////////////////////////////////////////////////////////////////
0031 //
0032 //  The new Boost.Iterator library already conatins a transform_iterator usable
0033 //  for our needs. The code below wraps this up.
0034 //
0035 ///////////////////////////////////////////////////////////////////////////////
0036     template <class AdaptableUnaryFunctionT, class IteratorT>
0037     class ref_transform_iterator_generator
0038     {
0039         typedef typename AdaptableUnaryFunctionT::result_type   return_type;
0040         typedef typename AdaptableUnaryFunctionT::argument_type argument_type;
0041 
0042     public:
0043         typedef boost::transform_iterator<
0044                 return_type (*)(argument_type), IteratorT, return_type>
0045             type;
0046     };
0047 
0048     template <class AdaptableUnaryFunctionT, class IteratorT>
0049     inline
0050     typename ref_transform_iterator_generator<
0051         AdaptableUnaryFunctionT, IteratorT>::type
0052     make_ref_transform_iterator(
0053         IteratorT base, AdaptableUnaryFunctionT const &f)
0054     {
0055         typedef typename ref_transform_iterator_generator<
0056                 AdaptableUnaryFunctionT, IteratorT>::type
0057             iterator_type;
0058         return iterator_type(base, f.transform);
0059     }
0060 
0061     //  Retrieve the token value given a parse node
0062     //  This is used in conjunction with the ref_transform_iterator above, to
0063     //  get the token values while iterating directly over the parse tree.
0064     template <typename TokenT, typename ParseTreeNodeT>
0065     struct get_token_value {
0066 
0067         typedef TokenT const &result_type;
0068         typedef ParseTreeNodeT const &argument_type;
0069 
0070         static result_type
0071         transform (argument_type node)
0072         {
0073             BOOST_ASSERT(1 == std::distance(node.value.begin(),
0074                 node.value.end()));
0075             return *node.value.begin();
0076         }
0077     };
0078 
0079 ///////////////////////////////////////////////////////////////////////////////
0080 }   // namespace impl
0081 }   // namespace wave
0082 }   // namespace boost
0083 
0084 // the suffix header occurs after all of the code
0085 #ifdef BOOST_HAS_ABI_HEADERS
0086 #include BOOST_ABI_SUFFIX
0087 #endif
0088 
0089 #endif // !defined(BOOST_TRANSFORM_ITERATOR_HPP_D492C659_88C7_4258_8C42_192F9AE80EC0_INCLUDED)