Caffe2 - C++ API
A deep learning, cross platform ML framework
map_utils.h
1 #pragma once
2 
3 namespace caffe2 {
4 
5 // Get value from map given key. Return suppiled default value if not found
6 // This is a stripped down version from folly:
7 // https://github.com/facebook/folly/blob/5a07e203d79324b68d69f294fa38e43b9671e9b1/folly/MapUtil.h#L35-L45
8 template <
9  class Map,
10  typename Key = typename Map::key_type,
11  typename Value = typename Map::mapped_type>
12 typename Map::mapped_type
13 get_default(const Map& map, const Key& key, Value&& dflt) {
14  using M = typename Map::mapped_type;
15  auto pos = map.find(key);
16  return (pos != map.end()) ? (pos->second) : M(std::forward<Value>(dflt));
17 }
18 
19 } // namespace caffe2
Definition: any.cpp:108
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13