diff --git a/test-files/golden-tests/metadata/sfinae.adoc b/test-files/golden-tests/metadata/sfinae.adoc new file mode 100644 index 000000000..651420661 --- /dev/null +++ b/test-files/golden-tests/metadata/sfinae.adoc @@ -0,0 +1,392 @@ += Reference +:mrdocs: + +[#index] +== Global namespace + + +=== Namespaces + +[cols=1] +|=== +| Name + +| <> +|=== +=== Types + +[cols=2] +|=== +| Name | Description + +| <> +| The partial specialization of A is enabled via a template parameter + + + +| <> +| Specialization for floating point types + + + +|=== +=== Functions + +[cols=2] +|=== +| Name | Description + +| <> +| Enabled via return type + + + +| <> +| Enabled via type template parameter + + + +| <> +| Enabling a specified return type + + + +| <> +| Enabling a specified return type in another namespace + + + +| <> +| Enabled via return type with std::enable_if + + + +| <> +| Enabled via a non‐type template parameter with helper + + + +| <> +| Enabled via a non‐type template parameter without helper + + + +| <> +| Enabled via a non‐type template parameter using int instead of bool + + + +| <> +| Enabled via parameter without helper + + + +| <> +| Enabled via parameter with helper + + + +|=== + +[#B] +== B + + +=== Types + +[cols=1] +|=== +| Name + +| <> +|=== + +[#B-C] +== <>::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 <><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> +<>::<> +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]# diff --git a/test-files/golden-tests/metadata/sfinae.cpp b/test-files/golden-tests/metadata/sfinae.cpp new file mode 100644 index 000000000..a7c4ef179 --- /dev/null +++ b/test-files/golden-tests/metadata/sfinae.cpp @@ -0,0 +1,73 @@ +#include +#include + +/// Enabled via return type +template +std::enable_if_t, T> +f1(T value); + +/// Enabling a specified return type +template +std::enable_if_t, int> +f2(T value); + +namespace B { + struct C {}; +} + +/// Enabling a specified return type in another namespace +template +std::enable_if_t, B::C> +f3(T value); + +/// Enabled via return type with std::enable_if +template +typename std::enable_if, T>::type +f4(T value); + +/// Enabled via a non-type template parameter with helper +template , bool> = true> +T +f5(T value); + +/// Enabled via a non-type template parameter without helper +template, bool>::type = true> +T +f6(T value); + +/// Enabled via a non-type template parameter using int instead of bool +template = 0> +void f7(T value); + +/// Enabled via parameter without helper +template +T +f8(T value, typename std::enable_if>::type* = 0); + +/// Enabled via parameter with helper +template +T +f9(T value, std::enable_if_t>* = 0); + +/// Enabled via type template parameter +/// +/// 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). +/// +template>> +void f10(T* t); + +/// The partial specialization of A is enabled via a template parameter +template +class A {}; + +/// Specialization for floating point types +template +class A>> {}; diff --git a/test-files/golden-tests/metadata/sfinae.html b/test-files/golden-tests/metadata/sfinae.html new file mode 100644 index 000000000..1d9c9d4e5 --- /dev/null +++ b/test-files/golden-tests/metadata/sfinae.html @@ -0,0 +1,411 @@ + + +Reference + + +
+

Reference

+
+
+

Global namespace

+
+

Namespaces

+ + + + + + + + + + +
Name
B
+

Types

+ + + + + + + + + + + +
NameDescription
A

The partial specialization of A is enabled via a template parameter

+ +
A<T, void>

Specialization for floating point types

+ +
+

Functions

+ + + + + + + + + + + + + + + + + + + +
NameDescription
f1

Enabled via return type

+ +
f10

Enabled via type template parameter

+ +
f2

Enabling a specified return type

+ +
f3

Enabling a specified return type in another namespace

+ +
f4

Enabled via return type with std::enable_if

+ +
f5

Enabled via a non-type template parameter with helper

+ +
f6

Enabled via a non-type template parameter without helper

+ +
f7

Enabled via a non-type template parameter using int instead of bool

+ +
f8

Enabled via parameter without helper

+ +
f9

Enabled via parameter with helper

+ +
+
+
+
+

B

+
+

Types

+ + + + + + + + + + +
Name
C
+
+
+
+

B::C

+
+
+

Synopsis

+
+Declared in <sfinae.cpp>
+
+
+struct C;
+
+
+
+ + +
+
+
+

A

+
+

The partial specialization of A is enabled via a template parameter

+ + +
+
+
+

Synopsis

+
+Declared in <sfinae.cpp>
+
+
+template<
+    class T,
+    class Enable = void>
+class A;
+
+
+
+ + +
+
+
+

A<T, void>

+
+

Specialization for floating point types

+ + +
+
+
+

Synopsis

+
+Declared in <sfinae.cpp>
+
+
+template<class T>
+class A<T, void>;
+
+
+
+ + +
+
+
+

f1

+
+

Enabled via return type

+ + +
+
+
+

Synopsis

+
+Declared in <sfinae.cpp>
+
+
+template<class T>
+T
+f1(T value);
+
+
+
+
+
+
+

f10

+
+

Enabled via type template parameter

+ + +
+
+
+

Synopsis

+
+Declared in <sfinae.cpp>
+
+
+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

+
+

Enabling a specified return type

+ + +
+
+
+

Synopsis

+
+Declared in <sfinae.cpp>
+
+
+template<class T>
+int
+f2(T value);
+
+
+
+
+
+
+

f3

+
+

Enabling a specified return type in another namespace

+ + +
+
+
+

Synopsis

+
+Declared in <sfinae.cpp>
+
+
+template<class T>
+B::C
+f3(T value);
+
+
+
+
+
+
+

f4

+
+

Enabled via return type with std::enable_if

+ + +
+
+
+

Synopsis

+
+Declared in <sfinae.cpp>
+
+
+template<class T>
+T
+f4(T value);
+
+
+
+
+
+
+

f5

+
+

Enabled via a non-type template parameter with helper

+ + +
+
+
+

Synopsis

+
+Declared in <sfinae.cpp>
+
+
+template<
+    class T,
+    bool = true>
+T
+f5(T value);
+
+
+
+
+
+
+

f6

+
+

Enabled via a non-type template parameter without helper

+ + +
+
+
+

Synopsis

+
+Declared in <sfinae.cpp>
+
+
+template<
+    class T,
+    bool = true>
+T
+f6(T value);
+
+
+
+
+
+
+

f7

+
+

Enabled via a non-type template parameter using int instead of bool

+ + +
+
+
+

Synopsis

+
+Declared in <sfinae.cpp>
+
+
+template<
+    class T,
+    int = 0>
+void
+f7(T value);
+
+
+
+
+
+
+

f8

+
+

Enabled via parameter without helper

+ + +
+
+
+

Synopsis

+
+Declared in <sfinae.cpp>
+
+
+template<class T>
+T
+f8(
+    T value,
+    void* = 0);
+
+
+
+
+
+
+

f9

+
+

Enabled via parameter with helper

+ + +
+
+
+

Synopsis

+
+Declared in <sfinae.cpp>
+
+
+template<class T>
+T
+f9(
+    T value,
+    void* = 0);
+
+
+
+
+ +
+
+

Created with MrDocs

+
+ + \ No newline at end of file diff --git a/test-files/golden-tests/metadata/sfinae.xml b/test-files/golden-tests/metadata/sfinae.xml new file mode 100644 index 000000000..6ade18dfe --- /dev/null +++ b/test-files/golden-tests/metadata/sfinae.xml @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + +