stream_insert_decl_present.pass.cpp 954 B

1234567891011121314151617181920212223242526
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. // <string>
  9. // template<class charT, class traits, class Allocator>
  10. // basic_ostream<charT, traits>&
  11. // operator<<(basic_ostream<charT, traits>& os,
  12. // const basic_string_view<charT,traits> str);
  13. #include <string_view>
  14. #include <iosfwd>
  15. template <class SV, class = void>
  16. struct HasDecl : std::false_type {};
  17. template <class SV>
  18. struct HasDecl<SV, decltype(static_cast<void>(std::declval<std::ostream&>() << std::declval<SV&>()))> : std::true_type {};
  19. int main() {
  20. static_assert(HasDecl<std::string_view>::value, "streaming operator declaration not present");
  21. }