Luc
Contribution
3Contributions
0Contributions played
Tests
1Tests completed
20Questions completed
TechnologyProfessionTest
Sort by
Newest
Most popular
Last review
Filter by
Published
0
Not published
0
To review
3
TechnologyProfessionTest
Sort by
Newest
Most popular
Last review
Filter by
Published
0
Not published
0
To review
3
3 questions
Waiting for validation
0 vote0 run0 comment
Copying instances of the following class ```c++ class String { String(std::size_t l) : len(l) , ptr(new char[l + 1]) {} public: String(char const* s) : String(std::strlen(s)) { std::copy_n(s, len + 1, ptr); } ~String() { delete[] ptr; } private: std::size_t len; char* ptr; }; void somewhere() { String s1 = "foo"; String s2 = s1; } ```
Lucat Sep 25, 2025
Waiting for validation
0 vote0 run0 comment
Waiting for validation
0 vote0 run0 comment
In C++14, copying instances of the following class ```c++ class String { String(std::size_t l) : len(l) , ptr(std::make_unique<char[]>(l+1)) {} public: String(char const* s) : String(std::strlen(s)) { std::copy_n(s, len + 1, ptr.get()); } private: std::size_t len; std::unique_ptr<char[]> ptr; }; void somewhere() { String s1 = "foo"; String s2 = s1; } ```
Lucat Sep 25, 2025