What do we need std::as_const() for?
问题 C++11 has given us std::add_const; with C++17, we have a new structure - std::as_const(). The former just tacks a const before the type you provide it with. The second one is a proper (template of a) function, not type trait, which seems to do the same - except for when the type is an rvalue-reference, in which case it cannot be used. I don't quite understand the motivation for providing std::as_const() . Why do we need it in addition to std::add_const ? 回答1: "Need" is a strong word... std: