Boost logo

Boost :

From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2007-11-21 10:09:20

On Nov 21, 2007 10:07 PM, Andreas Harnack <ah.boost.04_at_[hidden]> wrote:
> So, it seems to me, that the template argument does not provide
> any additional value but only makes the expression above
> unnecessary complicate. Am I missing something?

Disclaimer: I am not part of the C++ Standards Committe. All that
follow are based on my interpretations of the situation.

Remember that some compilers (legacy I would like to think) do not
support template member functions. So for something in the standard
library to rely on a feature that not all compilers will support would
be careless.

Another is the issue of conversion, and enforcement of concepts on the
type T. When you want to ensure that T is default constructable and
assignable, and you want to force conversions of objects passed to
your function to T, you'd have code that looks like:

template <typename TReal>
struct polymorphic_conversion_forcer {

template <typename TDeduced>
void function(TDeduced const & t) {
  TReal r = t; // TReal should be default constructable and
assignable, and TDeduced should be convertible to TReal


I hope this contributes to why ostream_iterator needs the T defined as
a class template instead of as a deduced member function.

Dean Michael C. Berris
Software Engineer, Friendster, Inc.
[+63 928 7291459]
[+1 408 4049523]

Boost list run by bdawes at, gregod at, cpdaniel at, john at