give me a const iterator

http://lists.boost.org/MailArchives/boost/msg71266.php
(boost.devel 2004/09/15~)

In the pre-redmond mailing Walter Brown discusses the possibility of adding these members to standard container classes:

const_iterator cbegin();
const_iterator cend();
const_reverse_iterator crbegin();
const_reverse_iterator crbegin();

The motiviation is that we want to be able to say explicitly "give me a const iterator" without doing ugly casts.

('A`)マジで?ってゆーか,なんで"doing ugly casts"?文脈追えてねー.
#あーもしかしてそのまんま汎用関数に突っ込む時とか?それなら分かる分かる
↓"doing ugly casts"の例(キャストじゃないけれど)

std::vector<int> v;
// .....
std::vector<int>::const_iterator ci;
// .....
std::size_t d = std::distance<std::vector<int>::const_iterator>(v.begin(), ci); // うにゃ〜!!
//std::size_t d = std::distance(v.cbegin(), ci); // cbeginがあるとこう書ける