Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using {} instead of () when constructing objects in samples #90

Open
tzlaine opened this issue Feb 9, 2016 · 0 comments
Open

Comments

@tzlaine
Copy link
Contributor

tzlaine commented Feb 9, 2016

For example, in this:

struct id
{
    template<class T>
    T operator()(T x) const
    {
        return x;
    }
};

auto int_result = boost::fit::result<int>(id());
static_assert(std::is_same<decltype(int_result(true)), int>::value, "Not the same type");

Consider changing the second-to-last line to:

auto int_result = boost::fit::result<int>(id{});

This makes it obvious that the use of "id" is a construction, not a call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants