Boost logo

Boost :

From: Peder Holt (peder.holt_at_[hidden])
Date: 2004-12-08 15:44:57


On Tue, 7 Dec 2004 11:45:47 -0500, Arkadiy Vertleyb
<vertleyb_at_[hidden]> wrote:
> "Peder Holt" <peder.holt_at_[hidden]> wrote in message
>
> > ... 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.
>
> Right... I am very much surprised it works on VC6...
>
>
...
Then again, the following compiles with VC7.1, so maybe there is hope
after all :)

#pragma warning (disable:4786)
#include <map>
#include <list>
#include <iostream>

template<typename A0,typename A1>
void deduce_container(class std::list<A0,A1>::iterator)
{
    std::cout << "list" << "\n";
}

template<typename A0>
void deduce_container(class std::_Tree<A0>::iterator)
{
    std::cout << "map" << "\n";
}

int main() {
  std::map<int,double>::iterator a;
  std::list<int*>::iterator b;
  deduce_container(a);
  deduce_container(b);
  return 0;
}
>
> Arkadiy
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


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