本文整理汇总了C++中HT::end方法的典型用法代码示例。如果您正苦于以下问题:C++ HT::end方法的具体用法?C++ HT::end怎么用?C++ HT::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HT
的用法示例。
在下文中一共展示了HT::end方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mapOr
void mapOr(const HT& leftExp, const HT& rightExp, HT& result)
{
result.clear();
vector<int> vl(leftExp.size()), vr(rightExp.size()), vm;
transform(leftExp.begin(), leftExp.end(), vl.begin(), keySel);
transform(rightExp.begin(), rightExp.end(), vr.begin(), keySel);
sort(vl.begin(), vl.end());
sort(vr.begin(), vr.end());
set_union(vl.cbegin(), vl.cend(), vr.cbegin(), vr.cend(), inserter(vm, vm.begin()));
int i=0;
for (auto it = vm.cbegin(); it != vm.cend(); ++it, ++i)
result.insert(HT::value_type((*it), i));
}
示例2:
inline
typename HT::size_type
get_keys(HT& ht, typename HT::key_type* keys)
{
typename HT::size_type num_keys = 0;
typename HT::size_type stream_id = 0;
typename HT::size_type num_streams = 1;
#pragma mta use 100 streams
#pragma mta for all streams stream_id of num_streams
{
typename HT::thread_iterator begin = ht.begin(stream_id, num_streams);
typename HT::thread_iterator end = ht.end(stream_id, num_streams);
// Claim a block of indices for the occupied entries in the stream's
// region.
typename HT::size_type start_index = mt_incr(num_keys, end - begin);
// Get the keys from this stream's region.
for ( ; begin != end; ++begin)
{
keys[start_index] = begin->first;
++start_index;
}
}
return num_keys;
}
示例3: assign_contiguous_ids
inline
void assign_contiguous_ids(HT& ht, typename HT::size_type starting_value = 0)
{
typename HT::size_type stream_id = 0;
typename HT::size_type num_streams = 1;
#pragma mta use 75 streams
#pragma mta for all streams stream_id of num_streams
{
typename HT::thread_iterator begin_iter = ht.begin(stream_id, num_streams);
typename HT::thread_iterator end_iter = ht.end(stream_id, num_streams);
// Claim a block of indices for the occupied entries in the stream's
// region.
typename HT::size_type start_index = mt_incr(starting_value,
end_iter - begin_iter);
// Assign contiguous ids to the occupied entries in this stream's
// region.
for ( ; begin_iter != end_iter; ++begin_iter)
{
begin_iter->second = start_index;
++start_index;
}
}
}
示例4: debug_buckets
void debug_buckets(HT const& hashtable) {
std::multimap<size_t, MyClass const*> debug_map;
std::transform(hashtable.begin(), hashtable.end(),
std::inserter(debug_map, debug_map.end()),
[&](MyClass const& mc) { return std::make_pair(hashtable.bucket(mc), &mc); }
);
std::cout << "\nDebugging buckets of hashtable\n";
for (auto& entry : debug_map)
std::cout << "Debug bucket: " << entry.first << " -> " << *entry.second << "\n";
}
示例5: erase
//***********************************************************************
void erase(HT& T, int start, int finish)
{
if (!T.empty()) {
int s = T.size();
for (int i = start; i < s && i <= finish; ++i) {
for (HT::iterator it = T.begin(); it != T.end(); ++it)
if (it->second == i) {
T.erase(it);
break;
}
}
for (auto &temp : T)
if (temp.second >= finish)
temp.second = temp.second - (finish - start) - 1;
}
}
示例6: end
/// Get a const iterator to the end of the table
const_iterator end() const { return m_ht.end(); }