Skip to content

Commit d5ab329

Browse files
Meta: update comments for eraser.
1 parent af04a67 commit d5ab329

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

code/include/swoc/swoc_meta.h

+12-7
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,22 @@ template <typename T> T TypeFunc();
123123
* This has no effect on @a u but fools the compiler in to thinking @a T has been used.
124124
* This avoids metaprogramming issues with unused template parameters.
125125
*
126-
* Suppose an API has changed a function from "delain" to "Delain". To handle this the metacase support is used, but there is
127-
* no apparent template parameter. A fake one can be used and defaulted to @c void. But that creates the unused template
128-
* parameter warning. This is fixed by doing something like
126+
* Suppose an API has changed a function from "cheer_for_delain" to "cheer_delain". To handle this
127+
* the metacase support is used, but there is no apparent template parameter. A fake one can be used
128+
* and defaulted to @c void. But that creates the unused template parameter warning. This is fixed
129+
* by doing something to erase the template parameter @a V while forwarding parameter @a x. The result
130+
* is a function @c f that calls the correct function automatically. Note this can't be in the body of
131+
* the function because even for SFINAE the function body must compile and the variant with the wrong
132+
* function will fail.
133+
*
129134
* @code
130135
* template <typename V = void>
131-
* auto f(UDT x, swoc::meta::CaseTag<0>) -> decltype(delain(eraser<V>(x)))
132-
* { return delain(eraser<V>(x)); }
136+
* auto f(UDT x, swoc::meta::CaseTag<0>) -> decltype(cheer_for_delain(eraser<V>(x)))
137+
* { return cheer_for_delain(eraser<V>(x)); }
133138
*
134139
* template <typename V = void>
135-
* auto f(UDT x, swoc::meta::CaseTag<1>) -> decltype(Delain(eraser<V>(x)))
136-
* { return Delain(eraser<V>(vc)); }
140+
* auto f(UDT x, swoc::meta::CaseTag<1>) -> decltype(cheer_delain(eraser<V>(x)))
141+
* { return cheer_delain(eraser<V>(x)); }
137142
*
138143
* f(x, swoc::meta::CaseArg); // Invoke the correctly named function
139144
* @endcode

0 commit comments

Comments
 (0)