|
Boost : |
From: David A. Greene (greened_at_[hidden])
Date: 2002-11-05 15:33:18
scleary_at_[hidden] wrote:
>>From: David A. Greene [mailto:greened_at_[hidden]]
>>
>><snip>
>>
>>Nowhere is "decrement" declared or defined in the filter_iterator
>>policies yet it can still be used with iterator_adaptor. How
>>does this work? Shouldn't the compiler complain that
>>iterator_adaptor::operator--() can't find
>>filter_iterator_policies::decrement? I could understand if
>>operator-- were a template member but it's not. I'm obviously
>>missing something. What is it?
>
>
> Well, it's not really "used" by iterator_adaptor. Since iterator_adaptor is
> a template class, the compiler will not instantiate its member functions
> unless they are actually used (i.e., called). This is true even though
> operator-- is not a template member.
Oh! Well, I learned something new today. I was under the impression
that when a class template is instantiated all of its non-template
members are also instantiated.
Hmm...this makes a few things I've been working on a bit easier.
-Dave
-- "Some little people have music in them, but Fats, he was all music, and you know how big he was." -- James P. Johnson
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk