-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9541176
commit 2a3c804
Showing
4 changed files
with
62 additions
and
27 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include <stdio.h> | ||
|
||
template<typename _t> | ||
struct test_thing {}; | ||
|
||
template<typename _t> | ||
struct tag {}; | ||
|
||
template<typename _t> | ||
void test(tag<_t>) | ||
{ | ||
printf("This is a test of a concrete function\n"); | ||
} | ||
|
||
template<typename _t> | ||
void test(tag<test_thing<_t>>); | ||
|
||
struct concrete | ||
{ | ||
virtual void test_func() = 0; | ||
}; | ||
|
||
template<typename _t> | ||
struct templated_struct : concrete | ||
{ | ||
void test_func() override | ||
{ | ||
test(tag<_t>{}); | ||
} | ||
}; | ||
|
||
int main() | ||
{ | ||
concrete* t_int = new templated_struct<int>(); | ||
concrete* t_test = new templated_struct<test_thing<int>>(); | ||
|
||
t_int ->test_func(); | ||
t_test->test_func(); | ||
|
||
return 0; | ||
} | ||
|
||
template<typename _t> | ||
void test(tag<test_thing<_t>>) | ||
{ | ||
printf("This is a tet of a partial function\n"); | ||
} |