Return to Snippet

Revision: 29717
at August 4, 2010 02:06 by mkluwe


Initial Code
#include <iostream>
#include <string>

template< class T >
class Foo;

template< class T>
class Foo< T* > {
public:
   Foo( const T *t ):
     t_( t ) {}
   void print() const {
       std::cout << *t_ << std::endl;
   }
private:
   const T *t_;
};

int main() {
   std::string s( "42" );
   Foo< std::string* >( &s ).print();
}

Initial URL


Initial Description


Initial Title
Template partial specialization

Initial Tags
template

Initial Language
C++