code refine

This commit is contained in:
Jinhao
2016-08-11 02:26:47 +08:00
parent 6e86b6ae6c
commit 9b28c96e9b
11 changed files with 225 additions and 125 deletions

View File

@@ -272,7 +272,7 @@ namespace nana
if(item.sub_menu == nullptr)
{
item.sub_menu = ⊂
sub.owner.push_back(&root_);
sub.owner.emplace_back(&root_);
return true;
}
}

View File

@@ -55,7 +55,7 @@ namespace nana
void append(const native_string_type& text, unsigned long shortkey)
{
if(shortkey && shortkey < 0x61) shortkey += (0x61 - 0x41);
cont_.push_back(new item_type(text, shortkey));
cont_.emplace_back(new item_type(text, shortkey));
}
std::size_t find(unsigned long shortkey) const

View File

@@ -748,14 +748,13 @@ namespace nana
bool _m_add_tab(std::size_t pos)
{
item_t m;
if((pos == npos) || (pos >= list_.size()))
{
this->list_.push_back(m);
this->list_.emplace_back();
pos = static_cast<unsigned>(list_.size() - 1);
}
else
list_.insert(iterator_at(pos), m);
list_.emplace(iterator_at(pos));
basis_.active = pos;
if(evt_agent_)
@@ -1505,7 +1504,7 @@ namespace nana
for (auto & m : items)
{
auto ts = graph.bidi_extent_size(m.text);
pxs.push_back(ts.width + 12);
pxs.emplace_back(ts.width + 12);
pixels += ts.width + 12;
}