Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<typename T, std::size_t N>
- constexpr std::size_t Length(const T(&)[N]) {
- return N;
- }
- struct Foo
- {
- unsigned int temp1[3];
- void Bar()
- {
- unsigned int temp2[Length(temp1)]; // Error here
- }
- };
- error C2131: expression did not evaluate to a constant
- note: failure was caused by a read of a variable outside its lifetime
- note: see usage of 'this'
Add Comment
Please, Sign In to add comment