24 #ifndef PXR_BASE_TF_STL_H
25 #define PXR_BASE_TF_STL_H
51 template <
class Key,
class Result>
54 typename Container::const_iterator i = map.find(key);
59 *valuePtr = i->second;
85 template <
class Container,
class Key,
class Result>
111 template <
class Container,
class Key,
class Result>
113 Key
const &key,
const Result &defaultValue)
115 typename Container::const_iterator i = map.find(key);
116 if (i == map.end()) {
139 template <
class Container,
class Key>
140 typename Container::mapped_type *
143 typename Container::iterator i = map.find(key);
144 return (i != map.end()) ? &(i->second) : NULL;
147 template <
class Container,
class Key>
148 typename Container::mapped_type
const *
151 typename Container::const_iterator i = map.find(key);
152 return (i != map.end()) ? &(i->second) : NULL;
163 template <
typename T>
164 inline std::pair<T,T>
166 return (a < b) ? std::pair<T,T>(
a,
b) : std::pair<T,T>(b,a);
194 template <
class Key,
class Value,
class Hash,
class Equal,
class Alloc>
204 if (hash.bucket_count() > emptyCount)
206 else if (!hash.empty())
213 template <
class Value,
class Hash,
class Equal,
class Alloc>
218 if (hash.bucket_count() > emptyCount)
220 else if (!hash.empty())
235 template <
class InputIterator1,
class InputIterator2,
class OutputIterator>
238 InputIterator2 first2, InputIterator2 last2,
241 typedef std::multiset<typename InputIterator2::value_type> SetType;
242 SetType set2(first2, last2);
246 for (InputIterator1 i = first1; i != last1; ++i) {
247 typename SetType::iterator
j = set2.find(*i);
266 template <
class BackInsertionSequence,
267 class InputIterator1,
class InputIterator2>
268 BackInsertionSequence
270 InputIterator2 first2, InputIterator2 last2)
272 BackInsertionSequence
result;
274 std::back_inserter(result));
289 template <
class InputIterator1,
class InputIterator2,
class OutputIterator>
292 InputIterator2 first2, InputIterator2 last2,
295 typedef std::set<typename InputIterator1::value_type> Set1Type;
296 typedef std::set<typename InputIterator2::value_type> Set2Type;
299 Set2Type set2(first2, last2);
303 for (InputIterator1 i = first1; i != last1; ++i)
304 if (set1.insert(*i).second && !set2.count(*i))
319 template <
class BackInsertionSequence,
320 class InputIterator1,
class InputIterator2>
321 BackInsertionSequence
323 InputIterator1 last1,
324 InputIterator2 first2,
325 InputIterator2 last2)
327 BackInsertionSequence
result;
329 std::back_inserter(result));
341 template <
class ForwardIterator,
class Predicate>
342 static inline ForwardIterator
343 TfFindBoundary(ForwardIterator
first, ForwardIterator
last,
344 Predicate
const &pred)
348 ForwardIterator middle;
353 std::advance(middle, half);
357 len = len - half - 1;
381 template <
class PairOrTuple>
384 template <
class PairOrTuple>
387 return std::get<N>(p);
390 template <
class PairOrTuple>
392 const PairOrTuple& p)
const
394 return std::get<N>(p);
397 template <
class PairOrTuple>
400 return std::get<N>(std::move(p));
406 #endif // PXR_BASE_TF_STL_H
static bool Lookup(Container const &map, Key const &key, Result *valuePtr)
imath_half_bits_t half
if we're in a C-only context, alias the half bits type to half
void swap(TfHashMap &other)
void swap(TfHashSet &other)
TF_API size_t Tf_GetEmptyHashSetBucketCount()
GLboolean GLboolean GLboolean GLboolean a
std::pair< T, T > TfOrderedPair(T a, T b)
**But if you need a result
void TfOrderedSetDifference(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result)
constexpr return_type< PairOrTuple > && operator()(PairOrTuple &&p) const
BackInsertionSequence TfOrderedSetDifferenceToContainer(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2)
bool TfMapLookup(Container const &map, Key const &key, Result *valuePtr)
constexpr const return_type< PairOrTuple > & operator()(const PairOrTuple &p) const
BackInsertionSequence TfOrderedUniquingSetDifferenceToContainer(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2)
void TfOrderedUniquingSetDifference(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result)
Container::mapped_type * TfMapLookupPtr(Container &map, Key const &key)
GLboolean GLboolean GLboolean b
__hostdev__ uint64_t last(uint32_t i) const
constexpr return_type< PairOrTuple > & operator()(PairOrTuple &p) const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
SIM_API const UT_StringHolder distance
typename std::tuple_element< N, PairOrTuple >::type return_type
TF_API size_t Tf_GetEmptyHashMapBucketCount()
const Result TfMapLookupByValue(Container const &map, Key const &key, const Result &defaultValue)