
1 Mar
2007
1 Mar
'07
3:02 p.m.
Thorsten Ottosen wrote:
shunsuke wrote:
Thorsten Ottosen wrote:
Only for random access iterators. std::size() would only accept random access iterators.
Hmm, when should I use 'std::size'? Whenever the argument is known to be RandomAccessRange, the 'std::distance' is known to be O(1) complexity. Thus, I will always use 'std::distance'. (I actually replaced all the 'boost::size' in my codes by 'boost::distance'.)
Right, but size() adds a compile time check to that. Of course, you may get that with a concept check in the beginning too.
I got it. I should agree different functions should have different names before wrapped around. Regards, -- Shunsuke Sogame