当前位置: 首页>>代码示例>>C++>>正文


C++ Hash_Map类代码示例

本文整理汇总了C++中Hash_Map的典型用法代码示例。如果您正苦于以下问题:C++ Hash_Map类的具体用法?C++ Hash_Map怎么用?C++ Hash_Map使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Hash_Map类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: reindex

void reindex(
  const IterablePairs& pairs,
  Hash_Map<PairValueType, PairValueType> & _reindexForward,
  Hash_Map<PairValueType, PairValueType> & _reindexBackward)
{
  typedef std::pair<PairValueType,PairValueType> PairT;
  // get an unique set of Ids
  std::set<size_t> _uniqueId;
  for(typename IterablePairs::const_iterator iter = pairs.begin();
        iter != pairs.end(); ++iter)
  {
    _uniqueId.insert(iter->first);
    _uniqueId.insert(iter->second);
  }

  // Build the Forward and Backward mapping
  for(typename IterablePairs::const_iterator iter = pairs.begin();
        iter != pairs.end(); ++iter)
  {
    if (_reindexForward.find(iter->first) == _reindexForward.end())
    {
      const size_t dist = std::distance(_uniqueId.begin(), _uniqueId.find(iter->first));
      _reindexForward[iter->first] = dist;
      _reindexBackward[dist] = iter->first;
    }
    if (_reindexForward.find(iter->second) == _reindexForward.end())
    {
      const size_t dist = std::distance(_uniqueId.begin(), _uniqueId.find(iter->second));
      _reindexForward[iter->second] = dist;
      _reindexBackward[dist] = iter->second;
    }
  }
}
开发者ID:Mohnish-SPU,项目名称:openMVG,代码行数:33,代码来源:sfm_global_reindex.hpp

示例2: ACE_TRACE

int Hash_Map_Example::run (void)
{
  ACE_TRACE ("Hash_Map_Example::run");

  for (int i = 0; i < 100; i++)
    {
      map_.bind (i, DataElement (i));
    }

  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Map has\n")));
  for (int j = 0; j < 100; j++)
    {
      DataElement d;
      map_.find (j, d);
      ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d:"), d.getData ()));
    }
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));

  // Use the forward iterator.
  this->iterate_forward ();

  // Use the reverse iterator.
  this->iterate_reverse ();

  // Remove all the elements from the map.
  this->remove_all ();

  // Iterate through the map again.
  this->iterate_forward ();

  return 0;
}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:32,代码来源:Hash_Map_Hash.cpp

示例3:

void reindex
(
  const IterablePairs& pairs,
  Hash_Map<PairValueType, PairValueType> & reindex_forward,
  Hash_Map<PairValueType, PairValueType> & reindex_backward
)
{
  // get a unique set of Ids
  std::set<size_t> unique_id;
  for (typename IterablePairs::const_iterator iter = pairs.begin();
        iter != pairs.end(); ++iter)
  {
    unique_id.insert(iter->first);
    unique_id.insert(iter->second);
  }

  // Build the Forward and Backward mapping
  for (typename IterablePairs::const_iterator iter = pairs.begin();
        iter != pairs.end(); ++iter)
  {
    if (reindex_forward.find(iter->first) == reindex_forward.end())
    {
      const size_t dist = std::distance(unique_id.begin(), unique_id.find(iter->first));
      reindex_forward[iter->first] = dist;
      reindex_backward[dist] = iter->first;
    }
    if (reindex_forward.find(iter->second) == reindex_forward.end())
    {
      const size_t dist = std::distance(unique_id.begin(), unique_id.find(iter->second));
      reindex_forward[iter->second] = dist;
      reindex_backward[dist] = iter->second;
    }
  }
}
开发者ID:autosquid,项目名称:openMVG,代码行数:34,代码来源:sfm_global_reindex.hpp

示例4: getFeatures

  /// Return the PointFeatures belonging to the View, if the view does not exist
  ///  it returns an empty PointFeature array.
  const features::PointFeatures & getFeatures(const IndexT & id_view) const
  {
    // Have an empty feature set in order to deal with non existing view_id
    static const features::PointFeatures emptyFeats = features::PointFeatures();

    Hash_Map<IndexT, features::PointFeatures>::const_iterator it = feats_per_view.find(id_view);
    if (it != feats_per_view.end())
      return it->second;
    else
      return emptyFeats;
  }
开发者ID:HustStevenZ,项目名称:openMVG,代码行数:13,代码来源:sfm_features_provider.hpp


注:本文中的Hash_Map类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。