assign_string_flag.pass.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233
  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. // <regex>
  9. // template <class charT, class traits = regex_traits<charT>> class basic_regex;
  10. // template <class string_traits, class A>
  11. // basic_regex& assign(const basic_string<charT, string_traits, A>& s,
  12. // flag_type f = regex_constants::ECMAScript);
  13. #include <regex>
  14. #include <cassert>
  15. #include "test_macros.h"
  16. int main(int, char**)
  17. {
  18. std::regex r2;
  19. r2.assign(std::string("(a([bc]))"));
  20. assert(r2.flags() == std::regex::ECMAScript);
  21. assert(r2.mark_count() == 2);
  22. r2.assign(std::string("(a([bc]))"), std::regex::extended);
  23. assert(r2.flags() == std::regex::extended);
  24. assert(r2.mark_count() == 2);
  25. return 0;
  26. }