lexcast_converter.qbk 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. [/
  2. Copyright (c) Vladimir Batov 2009-2016
  3. Distributed under the Boost Software License, Version 1.0.
  4. See copy at http://www.boost.org/LICENSE_1_0.txt.
  5. ]
  6. [import ../example/lexical_cast.cpp]
  7. [section:lexical_cast_converter ['boost::cnv::lexical_cast] Converter]
  8. The purpose of the converter is to
  9. * Make use of the `boost::lexical_cast` functionality and performance that many people have become accustomed to and comfortable with;
  10. * Demonstrate how existing independent conversion\/transformation-related facilities might be incorporated in to the ['Boost.Convert] framework.
  11. The converter can easily replace `boost::lexical_cast`, adding flexibility and convenience:
  12. [lexical_cast_headers1]
  13. [lexical_cast_example1]
  14. See the [classref boost::cnv::lexical_cast `boost::cnv::lexical_cast` implementation] for details.
  15. In order for a user-defined type to be integrated into the `boost::lexical_cast` framework and, consequently, deployed with the `boost::cnv::lexical_cast` converter:
  16. * ['TypeOut] needs to be [@http://en.cppreference.com/w/cpp/named_req/CopyConstructible ['Copy Constructible]];
  17. * ['TypeOut] needs to be [@http://en.cppreference.com/w/cpp/named_req/DefaultConstructible ['Default Constructible]];
  18. * ['TypeOut] needs to be ['Input Streamable];
  19. * ['TypeIn] needs to be ['Output Streamable].
  20. The first two requirements are imposed by the `boost::lexical_cast` design and implementation and the last two requirements by the underlying `std::stringstream` engine.
  21. [endsect]