|
Boost : |
From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-09-08 20:29:12
Hi Goran,
> First, why there isn't a way to register wstring type, even though I've
registered wchar_t? I've
> managed to use it only after I've registered basic_string template with
one template parameter.
> Seems inpractical...
There are a few choices here:
1)
BOOST_TYPEOF_REGISTER_TYPE(wstring);
2)
BOOST_TYPEOF_REGISTER_TYPE(wchar_t);
BOOST_TYPEOF_REGISTER_TEMPLATE(std::basic_string, 1);
3)
BOOST_TYPEOF_REGISTER_TYPE(wchar_t);
BOOST_TYPEOF_REGISTER_TEMPLATE(std::basic_string, 3);
BOOST_TYPEOF_REGISTER_TEMPLATE(std::char_traits, 1);
BOOST_TYPEOF_REGISTER_TEMPLATE(std::allocator, 1);
Pre-registration of STL types would be a very nice addition to the library.
For now I am avoiding this, and trying to focus on the facility itself.
> Second problem, no matter whether I've used wstring or basic_string for
registration, I wasn't able
> to get a type of wstring::iterator expression!
This is much more complicated problem, and I am not sure it can be
resolved...
The problem is that you can't specialize (or overload) on a nested types.
The Standard clearly says that this is a non-deducible context. So we can't
do something like:
template<class V, class T> encode_type<V, T::iterator>{}; // compiler error!
This is VERY unfortunate, and I 've been trying to think of workarounds, but
so far I only came up with one that is quite limited and ugly... So I
decided to put this on hold.
Regards,
Arkadiy
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk