Created
February 13, 2014 13:41
-
-
Save minamiyama1994/8975184 to your computer and use it in GitHub Desktop.
templateの概念からTMPの応用まで ref: http://qiita.com/minamiyama1994/items/1b1b72d6c8a0aa61c6f6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void abc(int arg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void abc(char arg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template < typename T > | |
struct vector { /* ... */ } ; | |
template < > | |
struct vector < int > { /* ... */ } ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template < typename T > | |
struct vector { /* ... */ } ; | |
template < typename T > | |
struct vector < hoge < T > > { /* ... */ } ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct some_struct | |
{ | |
typedef hoge_type hogehoge_type ; | |
} ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef int my_type ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct some_struct | |
{ | |
typedef hoge_type hogehoge_type ; | |
} ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template < typename T > | |
struct some_struct | |
{ | |
typedef hoge_type hogehoge_type ; | |
} ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template < typename T > | |
struct some_struct | |
{ | |
typedef T hogehoge_type ; | |
} ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template < typename T > | |
struct vector { /* ... */ } ; | |
template < > | |
struct vector < int > { /* ... */ } ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template < typename T > | |
struct vector { /* ... */ } ; | |
template < typename T > | |
struct vector < hoge < T > > { /* ... */ } ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template < typename T1 , typename T2 > | |
HogeType < T1 , T2 > operator + ( T1 t1 , T2 t2 ) ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int add ( int x , int y ) | |
{ | |
return x + y ; | |
} | |
double add ( double x , double y ) | |
{ | |
return x + y ; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int add ( int x , int y ) | |
{ | |
return x + y ; | |
} | |
double add ( double x , double y ) | |
{ | |
return x + y ; | |
} | |
float add ( float x , float y ) | |
{ | |
return x + y ; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int add ( int x , int y ) | |
{ | |
return x + y ; | |
} | |
double add ( double x , double y ) | |
{ | |
return x + y ; | |
} | |
float add ( float x , float y ) | |
{ | |
return x + y ; | |
} | |
long add ( long x , long y ) | |
{ | |
return x + y ; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template < typename T > | |
T add ( T x , T y ) | |
{ | |
return x + y ; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class vector_int { /* ... */ } ; | |
class vector_long { /* ... */ } ; | |
class vector_double { /* ... */ } ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template < typename T > | |
class vector { /* ... */ } ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct vector_int { /* ... */ } ; | |
struct vector_long { /* ... */ } ; | |
struct vector_double { /* ... */ } ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template < typename T > | |
struct vector { /* ... */ } ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment