FindWithDefault returns by value rather than reference.
Returning by reference leads to lifetime issues with the default
value which may go out of scope by the time it is used.
Thanks to @Ardavel for reporting this, as this causes graph_test
to fail on VS2015x64.
https://github.com/ceres-solver/ceres-solver/issues/216
Change-Id: I596481219cfbf7622d49a6511ea29193b82c8ba3
diff --git a/internal/ceres/map_util.h b/internal/ceres/map_util.h
index 61c531f..f55aee3 100644
--- a/internal/ceres/map_util.h
+++ b/internal/ceres/map_util.h
@@ -67,7 +67,7 @@
// If the key is present in the map then the value associated with that
// key is returned, otherwise the value passed as a default is returned.
template <class Collection>
-const typename Collection::value_type::second_type&
+const typename Collection::value_type::second_type
FindWithDefault(const Collection& collection,
const typename Collection::value_type::first_type& key,
const typename Collection::value_type::second_type& value) {