2020年2月10日 星期一

v1,v2

    auto v1 = constant<123>::value;
    auto v2 = constant<'z'>::value;

    foo::bar::z::something s;

    int v3 = (must_use_return_value(i), 5);

    // optional: may hold a value
    std::optional<int> a(5);
    std::optional<int> b;

    if (a.has_value()) {
        int z = *a + b.value_or(0); // *deref, or .value()
    }
    // also std::variant (a union) and std::any

    // Parallel STL algorithms
    std::vector<int> vec{ 1, 10, 8, 7, 15, 4, 5, 3 };
    std::sort(std::execution::par, vec.begin(), vec.end());

沒有留言:

張貼留言