本文整理汇总了C++中MapT::end方法的典型用法代码示例。如果您正苦于以下问题:C++ MapT::end方法的具体用法?C++ MapT::end怎么用?C++ MapT::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapT
的用法示例。
在下文中一共展示了MapT::end方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
std::set<typename MapT::mapped_type> value_set(const MapT& m) {
std::set<typename MapT::mapped_type> answer;
for (auto it = m.begin(); it != m.end(); ++it) {
answer.insert(it->second);
}
return answer;
}
示例2: assert
double
Note2FreqTable::operator[](string str) const
{
MapT::const_iterator iter = m_rep.find(str);
assert(iter != m_rep.end());
return iter->second;
}
示例3: load_and_init_with_map
static void load_and_init_with_map(const char* file, double* cpu_times, MapT& M)
{
FILE* f = fopen(file,"r");
if(f == NULL){
fprintf(stderr, "Could not open %s file: %s", file, strerror(errno));
exit(-1);
}
double nanosec;
char ops[48];
char line[512];
std::string tmp = "";
while(fgets(line,sizeof(line),f)){
unsigned op;
if (sscanf(line, "%47[^:]:\t%lf nanoseconds", ops, &nanosec) == 2) {
tmp = ops;
auto ite = M.find(ops);
if (ite != M.end()) {
op = ite->second;
cpu_times[op] = nanosec;
} else
continue;
}
}
fclose(f);
}
示例4: if
typename MapT::const_iterator find_nearest(MapT const& m, typename MapT::key_type const& query, typename MapT::key_type const& tolerance)
{
typename MapT::const_iterator cur, min, max, best;
min = m.lower_bound(query - tolerance);
max = m.lower_bound(query + tolerance);
if (min == m.end() || fabs(query - min->first) > tolerance)
return m.end();
else if (min == max)
return min;
else
best = min;
double minDiff = fabs(query - best->first);
for (cur = min; cur != max; ++cur)
{
double curDiff = fabs(query - cur->first);
if (curDiff < minDiff)
{
minDiff = curDiff;
best = cur;
}
}
return best;
}
示例5: while
typename MapT::const_iterator next_proton(typename MapT::const_iterator& iter_, const MapT& object)
{
while( iter_ != object.end()
&& (*iter_).second == identity_element<typename MapT::codomain_type>::value())
++iter_;
return iter_;
}
示例6: 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);
}
}
示例7: 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 />";
}
示例8: 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);
}
示例9: 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();
}
示例10:
bool
Cstore::VarRef::getValue(string& value, vtw_type_e& def_type)
{
vector<string> result;
MapT<string, bool> added;
def_type = ERROR_TYPE;
for (size_t i = 0; i < _paths.size(); i++) {
if (_paths[i].first.size() == 0) {
// empty path
continue;
}
if (added.find(_paths[i].first.back()) != added.end()) {
// already added
continue;
}
if (_paths[i].second == ERROR_TYPE
&& !_cstore->cfgPathExists(_paths[i].first, _active)) {
// path doesn't exist => empty string
added[""] = true;
result.push_back("");
continue;
}
if (_paths[i].second != ERROR_TYPE) {
// set def_type. all types should be the same if multiple entries exist.
def_type = _paths[i].second;
}
added[_paths[i].first.back()] = true;
result.push_back(_paths[i].first.back());
}
if (result.size() == 0) {
// got nothing
return false;
}
if (result.size() > 1 || def_type == ERROR_TYPE) {
/* if no type is available or we are returning "joined" multiple values,
* treat it as text type.
*/
def_type = TEXT_TYPE;
}
value = "";
for (size_t i = 0; i < result.size(); i++) {
if (i > 0) {
value += " ";
}
value += result[i];
}
return true;
}
示例11:
std::vector<typename MapT::mapped_type> map_values(MapT const& m)
{
return map_values<typename MapT::mapped_type>(m.begin(), m.end());
}
示例12: get_value_or
ValueT get_value_or(const MapT &map, const KeyT &key, ValueT def) {
typename MapT::const_iterator it(map.find(key));
return it != map.end() ? it->second : def;
}
示例13: 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
{
//.........这里部分代码省略.........