-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
1,102 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,392 @@ | ||
= Reference | ||
:mrdocs: | ||
|
||
[#index] | ||
== Global namespace | ||
|
||
|
||
=== Namespaces | ||
|
||
[cols=1] | ||
|=== | ||
| Name | ||
|
||
| <<B,`B`>> | ||
|=== | ||
=== Types | ||
|
||
[cols=2] | ||
|=== | ||
| Name | Description | ||
|
||
| <<A-09,`A`>> | ||
| The partial specialization of A is enabled via a template parameter | ||
|
||
|
||
|
||
| <<A-02,`A<T, void>`>> | ||
| Specialization for floating point types | ||
|
||
|
||
|
||
|=== | ||
=== Functions | ||
|
||
[cols=2] | ||
|=== | ||
| Name | Description | ||
|
||
| <<f1,`f1`>> | ||
| Enabled via return type | ||
|
||
|
||
|
||
| <<f10,`f10`>> | ||
| Enabled via type template parameter | ||
|
||
|
||
|
||
| <<f2,`f2`>> | ||
| Enabling a specified return type | ||
|
||
|
||
|
||
| <<f3,`f3`>> | ||
| Enabling a specified return type in another namespace | ||
|
||
|
||
|
||
| <<f4,`f4`>> | ||
| Enabled via return type with std::enable_if | ||
|
||
|
||
|
||
| <<f5,`f5`>> | ||
| Enabled via a non‐type template parameter with helper | ||
|
||
|
||
|
||
| <<f6,`f6`>> | ||
| Enabled via a non‐type template parameter without helper | ||
|
||
|
||
|
||
| <<f7,`f7`>> | ||
| Enabled via a non‐type template parameter using int instead of bool | ||
|
||
|
||
|
||
| <<f8,`f8`>> | ||
| Enabled via parameter without helper | ||
|
||
|
||
|
||
| <<f9,`f9`>> | ||
| Enabled via parameter with helper | ||
|
||
|
||
|
||
|=== | ||
|
||
[#B] | ||
== B | ||
|
||
|
||
=== Types | ||
|
||
[cols=1] | ||
|=== | ||
| Name | ||
|
||
| <<B-C,`C`>> | ||
|=== | ||
|
||
[#B-C] | ||
== <<B,B>>::C | ||
|
||
|
||
=== Synopsis | ||
|
||
|
||
Declared in `<sfinae.cpp>` | ||
|
||
[source,cpp,subs="verbatim,replacements,macros,-callouts"] | ||
---- | ||
struct C; | ||
---- | ||
|
||
|
||
|
||
|
||
[#A-09] | ||
== A | ||
|
||
|
||
The partial specialization of A is enabled via a template parameter | ||
|
||
|
||
|
||
=== Synopsis | ||
|
||
|
||
Declared in `<sfinae.cpp>` | ||
|
||
[source,cpp,subs="verbatim,replacements,macros,-callouts"] | ||
---- | ||
template< | ||
class T, | ||
class Enable = void> | ||
class A; | ||
---- | ||
|
||
|
||
|
||
|
||
[#A-02] | ||
== A<T, void> | ||
|
||
|
||
Specialization for floating point types | ||
|
||
|
||
|
||
=== Synopsis | ||
|
||
|
||
Declared in `<sfinae.cpp>` | ||
|
||
[source,cpp,subs="verbatim,replacements,macros,-callouts"] | ||
---- | ||
template<class T> | ||
class <<A-09,A>><T, void>; | ||
---- | ||
|
||
|
||
|
||
|
||
[#f1] | ||
== f1 | ||
|
||
|
||
Enabled via return type | ||
|
||
|
||
|
||
=== Synopsis | ||
|
||
|
||
Declared in `<sfinae.cpp>` | ||
|
||
[source,cpp,subs="verbatim,replacements,macros,-callouts"] | ||
---- | ||
template<class T> | ||
T | ||
f1(T value); | ||
---- | ||
|
||
[#f10] | ||
== f10 | ||
|
||
|
||
Enabled via type template parameter | ||
|
||
|
||
|
||
=== Synopsis | ||
|
||
|
||
Declared in `<sfinae.cpp>` | ||
|
||
[source,cpp,subs="verbatim,replacements,macros,-callouts"] | ||
---- | ||
template< | ||
class T, | ||
typename = void> | ||
void | ||
f10(T* t); | ||
---- | ||
|
||
=== Description | ||
|
||
|
||
This pattern should not be used because the function signature is unmodified and therefore only supports one overload. | ||
|
||
It's a common mistake is to declare two function templates that differ only in their default template arguments. | ||
|
||
This does not work because the declarations are treated as redeclarations of the same function template (default template arguments are not accounted for in function template equivalence). | ||
|
||
|
||
|
||
[#f2] | ||
== f2 | ||
|
||
|
||
Enabling a specified return type | ||
|
||
|
||
|
||
=== Synopsis | ||
|
||
|
||
Declared in `<sfinae.cpp>` | ||
|
||
[source,cpp,subs="verbatim,replacements,macros,-callouts"] | ||
---- | ||
template<class T> | ||
int | ||
f2(T value); | ||
---- | ||
|
||
[#f3] | ||
== f3 | ||
|
||
|
||
Enabling a specified return type in another namespace | ||
|
||
|
||
|
||
=== Synopsis | ||
|
||
|
||
Declared in `<sfinae.cpp>` | ||
|
||
[source,cpp,subs="verbatim,replacements,macros,-callouts"] | ||
---- | ||
template<class T> | ||
<<B,B>>::<<B-C,C>> | ||
f3(T value); | ||
---- | ||
|
||
[#f4] | ||
== f4 | ||
|
||
|
||
Enabled via return type with std::enable_if | ||
|
||
|
||
|
||
=== Synopsis | ||
|
||
|
||
Declared in `<sfinae.cpp>` | ||
|
||
[source,cpp,subs="verbatim,replacements,macros,-callouts"] | ||
---- | ||
template<class T> | ||
T | ||
f4(T value); | ||
---- | ||
|
||
[#f5] | ||
== f5 | ||
|
||
|
||
Enabled via a non‐type template parameter with helper | ||
|
||
|
||
|
||
=== Synopsis | ||
|
||
|
||
Declared in `<sfinae.cpp>` | ||
|
||
[source,cpp,subs="verbatim,replacements,macros,-callouts"] | ||
---- | ||
template< | ||
class T, | ||
bool = true> | ||
T | ||
f5(T value); | ||
---- | ||
|
||
[#f6] | ||
== f6 | ||
|
||
|
||
Enabled via a non‐type template parameter without helper | ||
|
||
|
||
|
||
=== Synopsis | ||
|
||
|
||
Declared in `<sfinae.cpp>` | ||
|
||
[source,cpp,subs="verbatim,replacements,macros,-callouts"] | ||
---- | ||
template< | ||
class T, | ||
bool = true> | ||
T | ||
f6(T value); | ||
---- | ||
|
||
[#f7] | ||
== f7 | ||
|
||
|
||
Enabled via a non‐type template parameter using int instead of bool | ||
|
||
|
||
|
||
=== Synopsis | ||
|
||
|
||
Declared in `<sfinae.cpp>` | ||
|
||
[source,cpp,subs="verbatim,replacements,macros,-callouts"] | ||
---- | ||
template< | ||
class T, | ||
int = 0> | ||
void | ||
f7(T value); | ||
---- | ||
|
||
[#f8] | ||
== f8 | ||
|
||
|
||
Enabled via parameter without helper | ||
|
||
|
||
|
||
=== Synopsis | ||
|
||
|
||
Declared in `<sfinae.cpp>` | ||
|
||
[source,cpp,subs="verbatim,replacements,macros,-callouts"] | ||
---- | ||
template<class T> | ||
T | ||
f8( | ||
T value, | ||
void* = 0); | ||
---- | ||
|
||
[#f9] | ||
== f9 | ||
|
||
|
||
Enabled via parameter with helper | ||
|
||
|
||
|
||
=== Synopsis | ||
|
||
|
||
Declared in `<sfinae.cpp>` | ||
|
||
[source,cpp,subs="verbatim,replacements,macros,-callouts"] | ||
---- | ||
template<class T> | ||
T | ||
f9( | ||
T value, | ||
void* = 0); | ||
---- | ||
|
||
|
||
|
||
[.small]#Created with https://www.mrdocs.com[MrDocs]# |
Oops, something went wrong.