Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*=============================================================================
0002     Copyright (c) 1999-2003 Jaakko Jarvi
0003     Copyright (c) 1999-2003 Jeremiah Willcock
0004     Copyright (c) 2001-2011 Joel de Guzman
0005 
0006     Distributed under the Boost Software License, Version 1.0. (See accompanying 
0007     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0008 ==============================================================================*/
0009 #if !defined(FUSION_OUT_05052005_0121)
0010 #define FUSION_OUT_05052005_0121
0011 
0012 #include <boost/fusion/support/config.hpp>
0013 #include <boost/fusion/sequence/io/detail/manip.hpp>
0014 
0015 #include <boost/mpl/bool.hpp>
0016 #include <boost/fusion/sequence/intrinsic/begin.hpp>
0017 #include <boost/fusion/sequence/intrinsic/end.hpp>
0018 #include <boost/fusion/iterator/deref.hpp>
0019 #include <boost/fusion/iterator/next.hpp>
0020 #include <boost/fusion/iterator/equal_to.hpp>
0021 
0022 namespace boost { namespace fusion { namespace detail
0023 {
0024     template <typename Tag>
0025     struct delimiter_out
0026     {
0027         // print a delimiter
0028         template <typename OS>
0029         static void
0030         print(OS& os, char const* delim, mpl::false_ = mpl::false_())
0031         {
0032             detail::string_ios_manip<Tag, OS> manip(os);
0033             manip.print(delim);
0034         }
0035 
0036         template <typename OS>
0037         static void
0038         print(OS&, char const*, mpl::true_)
0039         {
0040         }
0041     };
0042 
0043     struct print_sequence_loop
0044     {
0045         template <typename OS, typename First, typename Last>
0046         static void
0047         call(OS&, First const&, Last const&, mpl::true_)
0048         {
0049         }
0050 
0051         template <typename OS, typename First, typename Last>
0052         static void
0053         call(OS& os, First const& first, Last const& last, mpl::false_)
0054         {
0055             result_of::equal_to<
0056                 typename result_of::next<First>::type
0057               , Last
0058             >
0059             is_last;
0060 
0061             os << *first;
0062             delimiter_out<tuple_delimiter_tag>::print(os, " ", is_last);
0063             call(os, fusion::next(first), last, is_last);
0064         }
0065 
0066         template <typename OS, typename First, typename Last>
0067         static void
0068         call(OS& os, First const& first, Last const& last)
0069         {
0070             result_of::equal_to<First, Last> eq;
0071             call(os, first, last, eq);
0072         }
0073     };
0074 
0075     template <typename OS, typename Sequence>
0076     inline void
0077     print_sequence(OS& os, Sequence const& seq)
0078     {
0079         delimiter_out<tuple_open_tag>::print(os, "(");
0080         print_sequence_loop::call(os, fusion::begin(seq), fusion::end(seq));
0081         delimiter_out<tuple_close_tag>::print(os, ")");
0082     }
0083 }}}
0084 
0085 #endif