Sometimes it is necessary to pass an empty type to a template. For instance:
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 do not accept any parameters. This is pretty easy to implement with type checking:
struct Nothing {}; Nothing nothing = Nothing(); struct Free { typedef Nothing init; ... }; BoundaryConditions<Free, Fixed> foo(nothing, 100);
So, the question of my question is: is there something like my type “Nothing” in the standard library or boost?
source share