$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Peder Holt (peder.holt_at_[hidden])
Date: 2004-12-07 07:54:06
On Tue, 7 Dec 2004 08:35:16 +0100, Peder Holt <peder.holt_at_[hidden]> wrote:
> ...
> Turns out that the problem can be solved rather elegantly (for VC6.5, anyway :)
> The following code compiles in VC 6.5 :
>
> #pragma warning (disable:4786)
> #include <map>
> #include <list>
>
> template<typename A0,typename A1>
> void deduce_container(std::list<A0,A1>::iterator)
> {
> int b=0;
> }
>
> template<typename A0,typename A1,typename A2,typename A3,typename A4>
> void deduce_container(std::_Tree<A0, A1, A2, A3, A4>::iterator)
> {
> int b=0;
> }
>
> void main() {
> std::map<int,double>::iterator a;
> std::list<int*>::iterator b;
> deduce_container(a);
> deduce_container(b);
> }
> (Note that std::set<A0,A1,A2>::iterator is a typedef, and can not be
> deduced. std::_Tree<...>::iterator is an nested class, and can be
> deduced)
>
> I don't know if this is legal for other compilers, but if it is, we
> should define a new macro:
> REGISTER_NESTED_TEMPLATE_CLASS(std::list,2,iterator)
>
> It would then be possible to solve the stl problem outside the typeof
> library, in e.g. the stl/register.hpp (With separate registrations for
> the different stl-implementations, of course)
>
> Peder
>
... But this is nothing more than what you describe as a "non-deduced
context" :( Can't be applied in the general case, but solves the stl
iterators problem for selected compilers. Of course, if this doesn't
compile with VC7.1, it is of no use anyway.
Peder