1

I looked a bit into Eric Nieblers range library https://github.com/ericniebler/range-v3/ and there (/include/range/v3/utility/concepts.hpp, line 36) I found code of the form

constexpr struct valid_expr_t
{
    template<typename ...T>
    true_ operator()(T &&...) const;
} valid_expr {};

I am confused to the second scope/braces after valid_expr. What is the meaning of the whole construct. Is this even a struct definition? The syntax seems not allowed in C++98. What can go into these second pair of braces?

1 Answer 1

4

It's the C++11 uniform initialization syntax, and it simply initializes the valid_expr object.

It's like doing

struct valid_expr_t
{
    template<typename ...T>
    true_ operator()(T &&...) const;
};

constexpr valid_expr_t valid_expr {};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.