|
#include <iostream>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <locale>
|
|
#include <codecvt>
|
|
|
|
/* Unicode comment: δ½ ε₯½, δΈη, ππ */
|
|
|
|
int main() {
|
|
// Unicode string literals
|
|
std::string utf8 = "γγγ«γ‘γ―δΈη";
|
|
std::cout << utf8 << std::endl;
|
|
|
|
// Null byte in string
|
|
std::string null_str = std::string("hello\x00world", 11);
|
|
std::cout << "Null-str size: " << null_str.size() << std::endl;
|
|
|
|
// Deeply nested templates
|
|
template <typename T>
|
|
struct Wrap { T value; };
|
|
|
|
Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<Wrap<int>>>>>>>> deep = {{{{{{{{42}}}}}}}};
|
|
std::cout << deep.value.value.value.value.value.value.value.value << std::endl;
|
|
|
|
// Extremely long string
|
|
std::string long_str(10000, 'x');
|
|
std::cout << "Long string length: " << long_str.length() << std::endl;
|
|
|
|
// BOM-like bytes
|
|
const unsigned char bom[] = {0xEF, 0xBB, 0xBF, 'H', 'i', 0};
|
|
std::cout << reinterpret_cast<const char*>(bom) << std::endl;
|
|
|
|
// Deep lambda nesting
|
|
auto f1 = [](int x) {
|
|
return [x](int y) {
|
|
return [x, y](int z) {
|
|
return [x, y, z](int w) {
|
|
return x + y + z + w;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
std::cout << "Nested lambdas: " << f1(1)(2)(3)(4) << std::endl;
|
|
|
|
return 0;
|
|
}
|