|
Boost Users : |
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2008-04-07 14:30:18
Just an addition:
Explicit specialization of std templates is legal. So if you _exactly_ know
vector types for which your <<-operator should work you can write:
namespace std
{
template<>
ostream& operator<< (ostream& os, const vector<MyTypeX>& v)
{
copy(v.begin(), v.end(), ostream_iterator<T>(os, ";"));
return os;
}
}
By the way there was a big discussion about this on std list and I fluently
read the upcoming Standard draft and saw that this paragraph changed. I not
any longer sure if this will be allowed with the new standard.
Best Regards,
Ovanes
On Mon, Apr 7, 2008 at 8:14 PM, Steven Watanabe <watanabesj_at_[hidden]>
wrote:
> AMDG
>
> Scott McMurray wrote:
> > On Sun, Apr 6, 2008 at 5:15 PM, Andy Stevenson
> > <andy.stevenson_at_[hidden]> wrote:
> >
> >> Why doesn't the lexical_cast work below?
> >>
> >>
> >
> > Your operator<<'s not in namespace std, so ADL cannot find it.
> >
> > ( I think that's it, anyways. )
>
> Yes. It isn't legal to put it in namespace std, though.
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net