Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-12-08 16:15:47


"Peder Holt" <peder.holt_at_[hidden]> wrote

> Then again, the following compiles with VC7.1, so maybe there is hope
> after all :)

Wow...

The reason it compiles is that you are using "class" where I used
"typename". The following does not work:

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

I don't think this is a legal standard usage, though... Probably a
Microsoft - specific "feature"... Any comments from language experts?
Should the following work according to the Standard?

>
> #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


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