any_test_mplif.cpp 560 B

12345678910111213141516171819
  1. // Copyright Antony Polukhin, 2017-2019.
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See
  4. // accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. // This tests the issue from https://svn.boost.org/trac/boost/ticket/12052
  7. #include <iostream>
  8. #include <boost/any.hpp>
  9. int main() {
  10. boost::any a = 1;
  11. std::cout << boost::any_cast<int>(a) << '\n';
  12. a = 3.14;
  13. std::cout << boost::any_cast<double>(a) << '\n';
  14. a = true;
  15. std::cout << std::boolalpha << boost::any_cast<bool>(a) << '\n';
  16. }