In the factory function, I sometimes want to do nothing but return the newly created empty associative array.
One way to do this:
auto make_dict() { int[char] dict; return dict; }
Is there a way to avoid declaring a local dict variable? Something along the lines
auto make_dict() { return int[char]; }
or,
auto make_dict() { return int[char](); }
or,
auto make_dict() { return new int[char]; }
None of these works for reasons related to how associative arrays should be declared. Is there any way?
source share