string_view_from_rvalue.cpp 597 B

1234567891011121314151617181920212223242526
  1. /*
  2. Copyright (c) Marshall Clow 2017.
  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. For more information, see http://www.boost.org
  6. */
  7. #include <iostream>
  8. #include <algorithm>
  9. #include <string>
  10. #include <boost/utility/string_view.hpp>
  11. #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
  12. #error "Unsupported test"
  13. #endif
  14. std::string makeatemp() { return "abc"; }
  15. int main()
  16. {
  17. boost::basic_string_view<char> sv(makeatemp());
  18. return 0;
  19. }