Example
constexpr auto foo = [] [[deprecated]] { };
int main() {
foo(); // operator() is deprecated
}
Puzzle
- Can you implement variable template lambda expression
foo
which is marked nodiscard for integral types?
//TODO foo
int main() {
using namespace boost::ut;
"should be callable for non integral types"_test = [] {
foo<float>();
foo<double>();
};
"should verify the result for integral types"_test = [] {
expect(0_c == foo<char>());
expect(not foo<bool>());
expect(0_s == foo<short>());
expect(0_i == foo<int>());
};
"should ignore the result for integral types"_test = [] {
/*TODO*/ foo<char>();
/*TODO*/ foo<bool>();
/*TODO*/ foo<short>();
/*TODO*/ foo<int>();
};
}
Solutions