本文整理汇总了C++中MapT::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ MapT::begin方法的具体用法?C++ MapT::begin怎么用?C++ MapT::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapT
的用法示例。
在下文中一共展示了MapT::begin方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
std::set<typename MapT::key_type> key_set(const MapT& m) {
std::set<typename MapT::key_type> answer;
for (auto it = m.begin(); it != m.end(); ++it) {
answer.insert(it->first);
}
return answer;
}
示例2: BuildPalette
void wxsItemEditor::BuildPalette(wxNotebook* Palette)
{
Palette->DeleteAllPages();
bool AllowNonXRCItems = (m_Data->GetPropertiesFilter() & flSource);
// First we need to split all widgets into groups
// it will be done using multimap (map of arrays)
MapT Map;
for ( const wxsItemInfo* Info = wxsItemFactory::GetFirstInfo(); Info; Info = wxsItemFactory::GetNextInfo() )
{
if ( !Info->Category.empty() )
{
Map[Info->Category].Add(Info);
}
}
for ( MapT::iterator i = Map.begin(); i!=Map.end(); ++i )
{
wxScrolledWindow* CurrentPanel = new wxScrolledWindow(Palette,-1,wxDefaultPosition,wxDefaultSize,0/*wxALWAYS_SHOW_SB|wxHSCROLL*/);
CurrentPanel->SetScrollRate(1,0);
Palette->AddPage(CurrentPanel,i->first);
wxSizer* RowSizer = new wxBoxSizer(wxHORIZONTAL);
ItemsT& Items = i->second;
Items.Sort(PrioritySort);
for ( size_t j=Items.Count(); j-->0; )
{
const wxsItemInfo* Info = Items[j];
const wxBitmap& Icon = ( PalIconSize() == 16L ) ? Info->Icon16 : Info->Icon32;
if ( AllowNonXRCItems || Info->AllowInXRC )
{
wxWindow* Btn;
if ( Icon.Ok() )
{
Btn = new wxBitmapButton(CurrentPanel,-1,Icon,
wxDefaultPosition,wxDefaultSize,wxBU_AUTODRAW,
wxDefaultValidator, Info->ClassName);
RowSizer->Add(Btn,0,wxALIGN_CENTER);
}
else
{
Btn = new wxButton(CurrentPanel,-1,Info->ClassName,
wxDefaultPosition,wxDefaultSize,0,
wxDefaultValidator,Info->ClassName);
RowSizer->Add(Btn,0,wxGROW);
}
Btn->SetToolTip(Info->ClassName);
}
}
CurrentPanel->SetSizer(RowSizer);
RowSizer->SetVirtualSizeHints(CurrentPanel);
}
}
示例3: show_map_contents
void show_map_contents(OStreamT& os, MapT& m, const std::string& title)
{
os<< "<h3>" << title << "</h3>";
if (m.empty())
os<< "NONE<br />";
else
for (typename MapT::const_iterator i = m.begin(); i != m.end(); ++i)
os<< "<b>" << i->first << "</b> = <i>"
<< i->second << "</i><br />";
}
示例4: sort
void
Module::process_f_lit_map(MapT& map, vector<LitT>& vec)
{
vec.assign(map.begin(), map.end());
sort(vec.begin(), vec.end(), [](const LitT& lhs, const LitT& rhs) { return lhs.second > rhs.second; });
size_t new_size = vec.size();
for (; new_size > 0 && vec[new_size - 1].second <= 3; new_size--)
map.erase(vec[new_size - 1].first);
vec.resize(new_size);
for (size_t i = 0; i < vec.size(); i++)
map[vec[i].first] = static_cast<uint32_t>(i);
}
示例5: lexicographical_distinct_equal
bool lexicographical_distinct_equal(const MapT& left, const MapT& right)
{
if(&left == &right)
return true;
typename MapT::const_iterator left_ = left.begin();
typename MapT::const_iterator right_ = right.begin();
left_ = next_proton(left_, left);
right_ = next_proton(right_, right);
while(left_ != left.end() && right_ != right.end())
{
if(!(left_->first == right_->first && left_->second == right_->second))
return false;
++left_;
++right_;
left_ = next_proton(left_, left);
right_ = next_proton(right_, right);
}
return left_ == left.end() && right_ == right.end();
}
示例6: load
//! @internal
template <class Archive, class MapT> inline
void load( Archive & ar, MapT & map )
{
size_type size;
ar( make_size_tag( size ) );
map.clear();
auto hint = map.begin();
for( size_t i = 0; i < size; ++i )
{
typename MapT::key_type key;
typename MapT::mapped_type value;
ar( make_map_item(key, value) );
#ifdef CEREAL_OLDER_GCC
hint = map.insert( hint, std::make_pair(std::move(key), std::move(value)) );
#else // NOT CEREAL_OLDER_GCC
hint = map.emplace_hint( hint, std::move( key ), std::move( value ) );
#endif // NOT CEREAL_OLDER_GCC
}
}
示例7:
std::vector<typename MapT::mapped_type> map_values(MapT const& m)
{
return map_values<typename MapT::mapped_type>(m.begin(), m.end());
}
示例8: ProcessError
int ProcessError(
IdType error_type,
IdType error_Id,
IdType error_ref,
IdType error_cond,
NetVT* net_values_FF,
NetVT* net_values_E,
IdType &start_module_Id,
ForestT* forest,
int thread_num)
{
int retval = 0;
start_module_Id = NULL_Id;
IdType sum_Id2 = NULL_Id;
MapT* map2 = &net_values_FF[error_cond].root_Ids;
for (ValueType i=0; i<1; i++)
{
MapTI it = map2->find( i==0? 0 : (1<<net_widths[error_ref]) -1);
if (it != map2->end())
{
if (sum_Id2 == NULL_Id) sum_Id2 = it->second;
else {
IdType temp_Id = NULL_Id;
forest->AddTree(thread_num, it->second, sum_Id2, temp_Id, 0);
}
}
}
if (sum_Id2 == NULL_Id) return retval;
switch (error_type)
{
case 0: // Bus line struck
{
net_values_E[error_Id].root_Ids.clear();
IdType sum_Id = NULL_Id;
MapT* map = &net_values_FF[error_Id].root_Ids;
for (MapTI it = map->begin(); it != map->end(); it++)
{
if (sum_Id == NULL_Id) sum_Id = it->second;
else {
IdType sum_Id2 = NULL_Id;
forest->AddTree(thread_num, it->second, sum_Id, sum_Id2, 0);
sum_Id = sum_Id2;
}
}
net_values_E[error_Id].root_Ids.insert(MapTP(error_ref, sum_Id));
start_module_Id = nets[error_Id]->to_module;
break;
}
case 1: // Bus order error
{
//IdType sum_Id = NULL_Id;
MapT* map_ff = &net_values_FF[error_Id].root_Ids;
MapT* map_e = &net_values_E [error_Id].root_Ids;
map_e->clear();
for (MapTI it = map_ff->begin(); it != map_ff->end(); it++)
{
map_e->insert(MapTP(Reverse(it->first), it->second));
}
start_module_Id = nets[error_Id]->to_module;
break;
}
case 2: // Bus source error
{
//IdType sum_Id = NULL_Id;
MapT* map_ff = &net_values_FF[error_ref].root_Ids;
MapT* map_e = &net_values_E [error_Id].root_Ids;
map_e->clear();
for (MapTI it = map_ff->begin(); it != map_ff->end(); it++)
{
map_e->insert(MapTP(it->first, it->second));
}
start_module_Id = nets[error_Id]->to_module;
break;
}
case 3: // Bus count error
{
//IdType sum_Id = NULL_Id;
MapT* map_ff = &net_values_FF[error_Id].root_Ids;
MapT* map_e = &net_values_E [error_Id].root_Ids;
map_e->clear();
for (MapTI it_ff = map_ff->begin(); it_ff != map_ff->end(); it_ff++)
{
ValueType value = it_ff->first & ((1<<error_ref)-1);
MapTI it = map_ff->find(value);
if (it == map_ff->end())
map_e->insert(MapTP(value, it_ff->second));
else {
IdType temp_Id = NULL_Id;
retval = forest->AddTree(thread_num, it_ff->second, it->second, temp_Id, 0);
it->second = temp_Id;
}
}
start_module_Id = nets[error_Id]->to_module;
break;
}
case 4: // conditional bus stuck line
{
//.........这里部分代码省略.........