Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2008-02-06 11:34:35

Thorsten Ottosen wrote:
> Ok, but let me make the question more specific: why would you ever pass
> a container by value to push_back()?

Of course you wouldn't, but the first argument to push_back() may not,
in fact, be a container. It may be an expression template that evaluates
to a container.

I could consider making push_back() "smart" and check whether its first
argument is an expression template, or a terminal, or what, and assume
any type it doesn't know about is a container that should be stored by
reference, but this makes me uncomfortable. Now push_back() is special,
and special cases makes things harder to learn.

Eric Niebler
Boost Consulting

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