本文整理汇总了C++中std::vector::emplace_back方法的典型用法代码示例。如果您正苦于以下问题:C++ vector::emplace_back方法的具体用法?C++ vector::emplace_back怎么用?C++ vector::emplace_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::vector
的用法示例。
在下文中一共展示了vector::emplace_back方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startObject
bool startObject()
{
m_items.emplace_back(Item::StartObject);
return true;
}
示例2: add_footstep
void sounds::add_footstep( const tripoint &p, int volume, int, monster * )
{
sounds_since_last_turn.emplace_back(
std::make_pair( p, sound_event {volume, "", false, true, "", ""} ) );
}
示例3: TextToViewSettings
void TextToViewSettings(const string& ColumnTitles,const string& ColumnWidths, std::vector<column>& Columns)
{
// BUGBUG, add error checking
const wchar_t *TextPtr=ColumnTitles.data();
Columns.clear();
for (;;)
{
string strArgName;
if (!(TextPtr=GetCommaWord(TextPtr,strArgName)))
break;
Columns.emplace_back(VALUE_TYPE(Columns)());
string strArgOrig = strArgName;
ToUpper(strArgName);
if (strArgName.front() == L'N')
{
unsigned __int64 &ColumnType = Columns.back().type;
ColumnType = NAME_COLUMN;
const wchar_t *Ptr = strArgName.data() + 1;
while (*Ptr)
{
switch (*Ptr)
{
case L'M':
ColumnType |= COLUMN_MARK;
break;
case L'O':
ColumnType |= COLUMN_NAMEONLY;
break;
case L'R':
ColumnType |= COLUMN_RIGHTALIGN;
break;
case L'F':
ColumnType |= COLUMN_RIGHTALIGNFORCE;
break;
case L'N':
ColumnType |= COLUMN_NOEXTENSION;
break;
}
Ptr++;
}
}
else if (strArgName.front() == L'S' || strArgName.front() == L'P' || strArgName.front() == L'G')
{
unsigned __int64 &ColumnType = Columns.back().type;
ColumnType = (strArgName.front() == L'S') ? SIZE_COLUMN : (strArgName.front() == L'P') ? PACKED_COLUMN : STREAMSSIZE_COLUMN;
const wchar_t *Ptr = strArgName.data() + 1;
while (*Ptr)
{
switch (*Ptr)
{
case L'C':
ColumnType |= COLUMN_COMMAS;
break;
case L'E':
ColumnType |= COLUMN_ECONOMIC;
break;
case L'F':
ColumnType |= COLUMN_FLOATSIZE;
break;
case L'T':
ColumnType |= COLUMN_THOUSAND;
break;
}
Ptr++;
}
}
else if (!StrCmpN(strArgName.data(), L"DM", 2) || !StrCmpN(strArgName.data(), L"DC", 2) || !StrCmpN(strArgName.data(), L"DA", 2) || !StrCmpN(strArgName.data(), L"DE", 2))
{
unsigned __int64 &ColumnType = Columns.back().type;
switch (strArgName[1])
{
case L'M':
ColumnType = WDATE_COLUMN;
break;
case L'C':
ColumnType = CDATE_COLUMN;
break;
case L'A':
ColumnType = ADATE_COLUMN;
break;
case L'E':
ColumnType = CHDATE_COLUMN;
break;
}
const wchar_t *Ptr = strArgName.data() + 2;
while (*Ptr)
//.........这里部分代码省略.........
示例4: shouldStop
WorkerThreads(size_t threadCount=1) : shouldStop(false)
{
threads.reserve(threadCount);
for (size_t i=0; i<threadCount; i++)
threads.emplace_back(std::thread(&WorkerThreads::runWorker, this));
}
示例5: create_audio_frame
void create_audio_frame() override
{
frames.emplace_back(new AudioFrame(*this, "Untitled Audio", wxPoint(50, 50), wxSize(450, 340)));
frames.back()->Show(true);
}
示例6: append
void append(size_t size) {
v_.emplace_back();
v_.back().resize(size, false);
}
示例7: Assign
void Assign(std::future<void>&& future)
{
std::lock_guard<std::mutex> lock(mutex);
futures.emplace_back(std::move(future));
EraseReady();
}
示例8: boolean
bool boolean(const bool val)
{
m_items.emplace_back(val);
return true;
}
示例9: integerNumber
bool integerNumber(const int64_t val)
{
m_items.emplace_back(val);
return true;
}
示例10: endArray
bool endArray(const std::size_t size)
{
m_items.emplace_back(Item::EndArray, size);
return true;
}
示例11: null
bool null()
{
m_items.emplace_back(Item::Null);
return true;
}
示例12: startArray
bool startArray()
{
m_items.emplace_back(Item::StartArray);
return true;
}
示例13: endObject
bool endObject(const std::size_t size)
{
m_items.emplace_back(Item::EndObject, size);
return true;
}
示例14: key
bool key(const std::string &str)
{
m_items.emplace_back(Item::Key, str);
return true;
}
示例15: emplace
inline void emplace(TArgs&&... mArgs)
{
particles.emplace_back(FWD(mArgs)...);
}