In C# I can write something like this:
class AnyThing
{
static public T Default = default(T);
}
static void Main ()
{
Create your own default keyword:
class default_t
{
public:
template
operator T() const { return T(); }
};
default_t const default = default_t();
Use it like:
int myInt = default;
vector myVector = default;
shared_ptr myPtr = default;
Or with a slight semantic variation:
default_t const empty = default_t();
vector fetchPersons()
{
if (Database::isConnected())
{
return Database::fetchPersons();
}
return empty;
}