
14 Feb
2012
14 Feb
'12
4:32 p.m.
On Tue, Feb 14, 2012 at 5:07 PM, paul Fultz <pfultz2@yahoo.com> wrote:
One disadvantage of using a pointer instead of optional<T&> is when I write a functions to serach for an item in a map like this:
template<class T, class Map> optional<T&> search_for(Map& m, T& key);
Optional lets me call get_value_or() so I can return a value if it cant find the key,
but using a pointer I can't do that so easily. However, another class such as
Why not? get_value_or() for pointers seems trivial. Olaf