Hi2All..
I have some null struct, for example:
struct null_type
{
null_type& someNonVirtualMethod()
{
return *this;
}
};
And in some function i need to pass reference to this type. Reason:
template <typename T1 = null_type, typename T2 = null_type, ... >
class LooksLikeATupleButItsNotATuple
{
public:
LooksLikeATupleButItsNotATuple(T1& ref1 = defParamHere, T2& ref2 = andHere..)
: _ref1(ref1), _ref2(ref2), ...
{
}
void someCompositeFunctionHere()
{
_ref1.someNonVirtualMethod();
_ref2.someNonVirtualMethod();
...
}
private:
T1& _ref1;
T2& _ref2;
...;
};
It is a good practice to use null reference as a default parameter?:
*static_cast<NullType*>(0)
It works on MSVC, but i have some doubts...