delimit_out.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (c) 2001-2011 Hartmut Kaiser
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #if !defined(BOOST_SPIRIT_KARMA_DELIMIT_FEB_20_2007_1208PM)
  6. #define BOOST_SPIRIT_KARMA_DELIMIT_FEB_20_2007_1208PM
  7. #if defined(_MSC_VER)
  8. #pragma once
  9. #endif
  10. #include <boost/spirit/home/support/unused.hpp>
  11. #include <boost/spirit/home/karma/detail/unused_delimiter.hpp>
  12. namespace boost { namespace spirit { namespace karma
  13. {
  14. ///////////////////////////////////////////////////////////////////////////
  15. // Do delimiting. This is equivalent to p << d. The function is a
  16. // no-op if spirit::unused is passed as the delimiter-generator.
  17. ///////////////////////////////////////////////////////////////////////////
  18. template <typename OutputIterator, typename Delimiter>
  19. inline bool delimit_out(OutputIterator& sink, Delimiter const& d)
  20. {
  21. return d.generate(sink, unused, unused, unused);
  22. }
  23. template <typename OutputIterator>
  24. inline bool delimit_out(OutputIterator&, unused_type)
  25. {
  26. return true;
  27. }
  28. ///////////////////////////////////////////////////////////////////////////
  29. template <typename OutputIterator, typename Delimiter>
  30. inline bool delimit_out(OutputIterator&
  31. , detail::unused_delimiter<Delimiter> const&)
  32. {
  33. return true;
  34. }
  35. }}}
  36. #endif