Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstddef>
- struct wrapped_float
- {
- std::size_t value; //Initialize with sizeof(wrapped_float)
- float other; //Actual info
- };
- constexpr wrapped_float const a{ sizeof(a), 0 }; //OK
- struct test1 {
- static constexpr wrapped_float const b{ sizeof(b), 0 }; //Error!
- };
- struct test2 {
- static constexpr wrapped_float const b{ sizeof(test::b), 0 };
- };
- struct test3 {
- static constexpr wrapped_float const b{ sizeof(decltype(b)), 0 };
- };
- int main() {
- return a.value + test1::b.value + test2::b.value + test3::b.value;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement