Sometimes it is necessary to pass a dummy value without any data to some template. For example:
template <typename X, typename Y>
struct BoundaryConditions {
X x; Y y;
BoundaryConditions(typename X::init xi, typename Y::init yi) : x(xi), y(yi) {
...
}
};
We may wish to implement free boundary conditions that doesn't take any parameters. It's pretty easy to implement such a thing with type checking:
struct Nothing {};
Nothing nothing = Nothing();
struct Free {
typedef Nothing init;
...
};
BoundaryConditions<Free, Fixed> foo(nothing, 100);
So the matter of my question: is there an implementation of something like my Nothing
type in the standard library or boost?
You can use empty tuple. Like std::tuple<>();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With