MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/cpp/comments/70hf7f/useful_gcc_warning_options_not_enabled_by_wall/dn5pyyv
r/cpp • u/mttd • Sep 16 '17
71 comments sorted by
View all comments
Show parent comments
4
you can't assert or check that the desired "invariant" has been maintained
Yes, you can. You may not want to (or at least want to have to), but > is not a secret.
>
1 u/zvrba Sep 20 '17 For that to be useful, we'd need max_capacity for containers, which would return size_t(-1) / sizeof(T). 1 u/dodheim Sep 20 '17 Like std::allocator_traits<>::max_size (exposed by e.g. std::vector<>::max_size)? ;-]
1
For that to be useful, we'd need max_capacity for containers, which would return size_t(-1) / sizeof(T).
max_capacity
size_t(-1) / sizeof(T)
1 u/dodheim Sep 20 '17 Like std::allocator_traits<>::max_size (exposed by e.g. std::vector<>::max_size)? ;-]
Like std::allocator_traits<>::max_size (exposed by e.g. std::vector<>::max_size)? ;-]
std::allocator_traits<>::max_size
std::vector<>::max_size
4
u/dodheim Sep 18 '17
Yes, you can. You may not want to (or at least want to have to), but
>is not a secret.