24 #ifndef PXR_BASE_TF_STL_H
25 #define PXR_BASE_TF_STL_H
38 #include <hboost/call_traits.hpp>
53 template <
class Key,
class Result>
56 typename Container::const_iterator i = map.find(key);
61 *valuePtr = i->second;
87 template <
class Container,
class Key,
class Result>
113 template <
class Container,
class Key,
class Result>
115 Key
const &key,
const Result &defaultValue)
117 typename Container::const_iterator i = map.find(key);
118 if (i == map.end()) {
141 template <
class Container,
class Key>
142 typename Container::mapped_type *
145 typename Container::iterator i = map.find(key);
146 return (i != map.end()) ? &(i->second) : NULL;
149 template <
class Container,
class Key>
150 typename Container::mapped_type
const *
153 typename Container::const_iterator i = map.find(key);
154 return (i != map.end()) ? &(i->second) : NULL;
165 template <
typename T>
166 inline std::pair<T,T>
168 return (a < b) ? std::pair<T,T>(
a,
b) : std::pair<T,T>(b,a);
196 template <
class Key,
class Value,
class Hash,
class Equal,
class Alloc>
206 if (hash.bucket_count() > emptyCount)
208 else if (!hash.empty())
215 template <
class Value,
class Hash,
class Equal,
class Alloc>
220 if (hash.bucket_count() > emptyCount)
222 else if (!hash.empty())
232 inline typename hboost::call_traits<T>::param_type
248 template <
class InputIterator1,
class InputIterator2,
class OutputIterator>
251 InputIterator2 first2, InputIterator2 last2,
254 typedef std::multiset<typename InputIterator2::value_type> SetType;
255 SetType set2(first2, last2);
259 for (InputIterator1 i = first1; i != last1; ++i) {
260 typename SetType::iterator j = set2.find(*i);
279 template <
class BackInsertionSequence,
280 class InputIterator1,
class InputIterator2>
281 BackInsertionSequence
283 InputIterator2 first2, InputIterator2 last2)
285 BackInsertionSequence
result;
287 std::back_inserter(result));
302 template <
class InputIterator1,
class InputIterator2,
class OutputIterator>
305 InputIterator2 first2, InputIterator2 last2,
308 typedef std::set<typename InputIterator1::value_type> Set1Type;
309 typedef std::set<typename InputIterator2::value_type> Set2Type;
312 Set2Type set2(first2, last2);
316 for (InputIterator1 i = first1; i != last1; ++i)
317 if (set1.insert(*i).second && !set2.count(*i))
332 template <
class BackInsertionSequence,
333 class InputIterator1,
class InputIterator2>
334 BackInsertionSequence
336 InputIterator1 last1,
337 InputIterator2 first2,
338 InputIterator2 last2)
340 BackInsertionSequence
result;
342 std::back_inserter(result));
354 template <
class ForwardIterator,
class Predicate>
355 static inline ForwardIterator
356 TfFindBoundary(ForwardIterator
first, ForwardIterator last,
357 Predicate
const &pred)
361 ForwardIterator middle;
366 std::advance(middle, half);
370 len = len - half - 1;
394 template <
class PairOrTuple>
397 template <
class PairOrTuple>
400 return std::get<N>(
p);
403 template <
class PairOrTuple>
405 const PairOrTuple&
p)
const
407 return std::get<N>(
p);
410 template <
class PairOrTuple>
413 return std::get<N>(std::move(
p));
419 #endif // PXR_BASE_TF_STL_H
GLboolean GLboolean GLboolean b
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()
std::pair< T, T > TfOrderedPair(T a, T b)
void TfOrderedSetDifference(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result)
constexpr return_type< PairOrTuple > && operator()(PairOrTuple &&p) const
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
BackInsertionSequence TfOrderedSetDifferenceToContainer(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2)
hboost::call_traits< T >::param_type TfIdentity(typename hboost::call_traits< T >::param_type arg)
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)
GLsizei GLsizei GLfloat distance
void TfOrderedUniquingSetDifference(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result)
Container::mapped_type * TfMapLookupPtr(Container &map, Key const &key)
GLboolean GLboolean GLboolean GLboolean a
constexpr return_type< PairOrTuple > & operator()(PairOrTuple &p) const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
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)