Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'extern/ceres/internal/ceres/map_util.h')
-rw-r--r--extern/ceres/internal/ceres/map_util.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/extern/ceres/internal/ceres/map_util.h b/extern/ceres/internal/ceres/map_util.h
index f55aee37689..6e310f8db2d 100644
--- a/extern/ceres/internal/ceres/map_util.h
+++ b/extern/ceres/internal/ceres/map_util.h
@@ -34,6 +34,7 @@
#define CERES_INTERNAL_MAP_UTIL_H_
#include <utility>
+
#include "ceres/internal/port.h"
#include "glog/logging.h"
@@ -55,9 +56,9 @@ namespace ceres {
// This version assumes the key is printable, and includes it in the fatal log
// message.
template <class Collection>
-const typename Collection::value_type::second_type&
-FindOrDie(const Collection& collection,
- const typename Collection::value_type::first_type& key) {
+const typename Collection::value_type::second_type& FindOrDie(
+ const Collection& collection,
+ const typename Collection::value_type::first_type& key) {
typename Collection::const_iterator it = collection.find(key);
CHECK(it != collection.end()) << "Map key not found: " << key;
return it->second;
@@ -67,10 +68,10 @@ FindOrDie(const Collection& collection,
// 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
-FindWithDefault(const Collection& collection,
- const typename Collection::value_type::first_type& key,
- const typename Collection::value_type::second_type& value) {
+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) {
typename Collection::const_iterator it = collection.find(key);
if (it == collection.end()) {
return value;
@@ -84,7 +85,7 @@ FindWithDefault(const Collection& collection,
// took place, false indicates the key was already present.
template <class Collection>
bool InsertIfNotPresent(
- Collection * const collection,
+ Collection* const collection,
const typename Collection::value_type::first_type& key,
const typename Collection::value_type::second_type& value) {
std::pair<typename Collection::iterator, bool> ret =
@@ -96,9 +97,9 @@ bool InsertIfNotPresent(
// Same as above but the returned pointer is not const and can be used to change
// the stored value.
template <class Collection>
-typename Collection::value_type::second_type*
-FindOrNull(Collection& collection, // NOLINT
- const typename Collection::value_type::first_type& key) {
+typename Collection::value_type::second_type* FindOrNull(
+ Collection& collection, // NOLINT
+ const typename Collection::value_type::first_type& key) {
typename Collection::iterator it = collection.find(key);
if (it == collection.end()) {
return 0;
@@ -116,13 +117,13 @@ bool ContainsKey(const Collection& collection, const Key& key) {
// Inserts a new key/value into a map or hash_map.
// Dies if the key is already present.
-template<class Collection>
+template <class Collection>
void InsertOrDie(Collection* const collection,
const typename Collection::value_type::first_type& key,
const typename Collection::value_type::second_type& data) {
typedef typename Collection::value_type value_type;
CHECK(collection->insert(value_type(key, data)).second)
- << "duplicate key: " << key;
+ << "duplicate key: " << key;
}
} // namespace ceres