Skip to content

Commit

Permalink
update: 完成 26 题
Browse files Browse the repository at this point in the history
Signed-off-by: YdrMaster <[email protected]>
  • Loading branch information
YdrMaster committed Jul 15, 2024
1 parent c248b13 commit a8949ec
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion exercises/26_std_string/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
#include "../exercise.h"
#include <string>

// READ: 字符串 <https://zh.cppreference.com/w/cpp/string/basic_string>

int main(int argc, char **argv) {
ASSERT(false, "todo!");
// READ: 字符串字面量 <https://zh.cppreference.com/w/cpp/string/basic_string/operator%22%22s>
using namespace std::string_literals;
auto hello = "Hello"s;
auto world = "world";
// READ: `decltype` 表达式 <https://zh.cppreference.com/w/cpp/language/decltype>
// READ: `std::is_same_v` 元编程判别 <https://zh.cppreference.com/w/cpp/types/is_same>
ASSERT((std::is_same_v<decltype(hello), ?>), "Fill in the missing type.");
ASSERT((std::is_same_v<decltype(world), ?>), "Fill in the missing type.");
// TODO: 将 `?` 替换为正确的字符串
ASSERT(hello + ", " + world + '!' == "?", "Fill in the missing string.");
return 0;
}

0 comments on commit a8949ec

Please sign in to comment.