fork download
  1. // 21.4.2/2 (the copy ctor): data()
  2. // points at the first element of an allocated copy
  3. // of the array whose first element is pointed at by
  4. // str.data()
  5. #include <string>
  6. #include <cassert>
  7.  
  8. void f(const std::string& a, const std::string& b)
  9. {
  10. assert(std::not_equal_to<const char*>()(a.data(), b.data()));
  11. }
  12.  
  13. int main()
  14. {
  15. std::string a("abc");
  16. std::string b(a);
  17. f(a, b);
  18. }
Runtime error #stdin #stdout 0s 2980KB
stdin
Standard input is empty
stdout
Standard output is empty