auto container_type::lower_bound(const string &s) -> iterator {
auto it = const_cast<const container_type *const>(this)->lower_bound(s);
return underlying_container.erase(it, it); // Some standard container of strings that container_type encapsulates.
}
auto container_type::lower_bound(const string &s) const -> const_iterator {
return lower_bound(underlying_container.cbegin(), underlying_container.cend(), s);
}
Jan 11, 2016
[C++] cast away this ptr's pointed object's constness
[reddit] const away this ptr pointed object's constness.
Labels:
cpp,
cpp_const_cast
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.