Boost logo

Boost :

From: Glenn G. Chappell (ggchappell_at_[hidden])
Date: 2003-02-03 19:36:41


Vladimir Prus wrote:
> after having to output std::vector to stream again and again using
> custom
> solution, I started to wonder why we don't have a solution in boost.
> Does it makes sense to include operators<< for vectors, sets, etc?
...
> std::cout << "new path is " << v << "\n";

The philosophy behind the STL would suggest accessing containers
through their iterators. Something like

std::cout << "new path is "
          << Foo(v.begin(), v.end())
          << "\n";

would not be too bad (and it would be even better if it were called
something besides "Foo"). This would be very general, while
remaining quite readble, I think.

Delimiters could be set using optional parameters, among other
methods.

std::cout << "new path is "
          << Foo(v.begin(), v.end(), "[", ",", "]")
          << "\n";

=====
Glenn G. Chappell <>< chappellg_at_[hidden]
Dept. of Mathematical Sciences * Ofc: (907) 474-5736
University of Alaska Fairbanks * Fax: (907) 474-5394

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk