Classes | Functions
test_templbasename.cxx File Reference
#include <iostream>
#include <string>
#include <typeinfo>
#include <vector>

Go to the source code of this file.

Classes

struct  IName
 
struct  INameT< T >
 
struct  A
 

Functions

int main ()
 

Function Documentation

int main ( void  )

Definition at line 25 of file test_templbasename.cxx.

26 {
27  A a;
28 
29  cerr << a.INameT<int>::name() << endl;
30  cerr << a.INameT<float>::name() << endl;
31 
32  // ambiguous, fails to compile.
33  //cerr << a.name() << endl;
34 
35  INameT<int>* ai = &a;
36  cerr << ai->name() << endl;
37 
38  INameT<float>* af = &a;
39  cerr << af->name() << endl;
40 
41 
42  cerr << "Via bases" << endl;
43  vector<IName*> named{ai,af};
44  for (auto n : named) {
45  cerr << n->name() << endl;
46  }
47 
48  return 0;
49 }
virtual std::string name() const
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
#define A
Definition: memgrp.cpp:38
std::size_t n
Definition: format.h:3399
QTextStream & endl(QTextStream &s)