0

Given a variable of an unsigned integral type: foo lets say I want to do this:

const decltype<foo> bar{};

cout << (55834574890LL & ~bar) << endl;

That gives me the expected 42. But now let's say that I want to do away with the bar variable. So something like this:

cout << (55834574890LL & ~decltype<foo>{}) << endl;

But I just get an error:

error: expected primary-expression before decltype

I've also tried declval but that returns a reference, which is also no good. Is there a way I can do this?

4

1 回答 1

2

You should use round brackets:

auto v = 55834574890LL & ~decltype(foo){};

Here's a demo.

于 2018-06-01T21:30:10.720 回答