boost_no_cxx14_std_exchange.ipp 621 B

1234567891011121314151617181920212223
  1. // (C) Copyright Oliver Kowalke 2016.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/config for most recent version.
  6. // MACRO: BOOST_NO_CXX14_STD_EXCHANGE
  7. // TITLE: apply
  8. // DESCRIPTION: The compiler supports the std::exchange() function.
  9. #include <utility>
  10. namespace boost_no_cxx14_std_exchange {
  11. int test() {
  12. int * i = new int( 1);
  13. int * j = std::exchange( i, nullptr);
  14. delete j;
  15. return 0;
  16. }
  17. }