Would it be possible to define isShorter as a constexpr? If so, do so. If not, explain why not
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:6| Question number:46
All Answers
total answers (1)
No, a
`constexpr`
function may only contains statements that generate no actions at run time, but the member method`size()`
must be called at run time, thus the function can not be a`constexpr`
function.