|
Boost : |
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-12-29 13:36:04
Peter Dimov wrote:
> Jonathan Turkanis wrote:
>> The occurence of boost::io::put in the above example has to be
>> qualified, since otherwise it will refer to the member function being
>> defined.
>
> What I have to say has nothing to do with namespaces or directory
> placement, but...
> Given that in the documentation you speak of user-defined overloads of
> boost::io::read et al, it might be worthwhile to point out that
> two-phase lookup will not see these user overloads. If you want to
> have an overload customization point in a template, you have to use
> an unqualified call. And choose the identifiers wisely. :-)
Yikes!
I knew there were limitations to customization by overloading, but I didn't
think I had stumbled over them yet. I objviously can't use unqualified calls
here, or change the names.
I arleady implement read, et al. by simulated tag-dispatch:
template<typename T>
inline std::streamsize
read(T& t, BOOST_IOSTREAMS_CHAR_TYPE(T)* s, std::streamsize n)
{
typedef typename detail::dispatch<
T, istream_tag, streambuf_tag, input
>::type tag;
return detail::read_impl<tag>::read(detail::unwrap(t), s, n);
}
I'd really hate to make read_impl and dispatch public, or to add yet another
level of indirection. :(
So maybe my best option is to excise those innocent-sounding passages you refer
to, and require users to write wrappers if they want to integrate existing
components into the framework.
Thanks for pointing this out!
Jonathan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk