本文整理汇总了C++中std::initializer_list类的典型用法代码示例。如果您正苦于以下问题:C++ initializer_list类的具体用法?C++ initializer_list怎么用?C++ initializer_list使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了initializer_list类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: any_of
bool any_of(const std::string& key, std::initializer_list<T> list) const {
std::unordered_map<std::string, double>::const_iterator it = _opt.find(key);
return (it != _opt.cend() && std::any_of(list.begin(), list.end(), [&](const T& t) { return t == static_cast<T>(it->second); }));
}
示例2:
AppInitializer::AppInitializer(std::initializer_list<int> subsystem_flags) {
for (auto it = subsystem_flags.begin(); it != subsystem_flags.end(); it++) {
initializeSystem(*it);
}
}
示例3: index
//! Requires: il.size() == Rank.
//! Effects: For all i in the range [0, Rank), initializes the ith
//! component of *this with *(il.begin() + i).
index(std::initializer_list<value_type> const& il)
{
HPX_ASSERT(il.size() == std::size_t(rank) &&
"il.size() must be equal to Rank");
std::copy(il.begin(), il.end(), vs_ + 0);
}
示例4: vec3
vec3(std::initializer_list<float> ilist) { auto* p = ilist.begin(); x = *p++; y = *p++; z = *p++; }
示例5: in
bool in(const std::initializer_list<T1>& s, const T2& x) {
return std::find(s.begin(), s.end(), x) != s.end();
}
示例6: binary
binary(std::initializer_list<uint8_t> bytes, const Alloc& alloc = Alloc())
: binary(reinterpret_cast<const char*>(bytes.begin()), bytes.size(), alloc) {}
示例7: init
void init(const std::initializer_list<int>& il) {
vect.resize(il.size());
std::move_backward(il.begin(), il.end(), vect.end());
}
示例8: setValues
void KeyMultiValueTagFilter::setValues(std::initializer_list<std::string> l)
{
setValues(l.begin(), l.end());
}
示例9:
//MultiKeyTagFilter
MultiKeyTagFilter::MultiKeyTagFilter(std::initializer_list< std::string > l) :
m_KeySet(l.begin(), l.end())
{}
示例10: pointer_vector
pointer_vector(std::initializer_list<T> list) : pool(0), poolsize(0), objectsize(0) {
for(const T *p = list.begin(); p != list.end(); ++p) append(*p);
}
示例11: comb
/*! \brief Constructor from a list of numbers
*
* \param c list of numbers
*
*/
comb(std::initializer_list<char> c)
{
size_t i = 0;
for(char x : c)
{this->c[c.size() - i - 1] = x;i++;}
}
示例12:
LinkedList<T>::LinkedList(std::initializer_list<T> elements)
{
head->data = elements.begin()[0];
}
示例13: spawn_in_groups
infer_handle_from_class_t<T>
spawn_in_groups(std::initializer_list<group> gs, Ts&&... xs) {
actor_config cfg;
return spawn_class_in_groups<T, Os>(cfg, gs.begin(), gs.end(),
std::forward<Ts>(xs)...);
}
示例14: addValues
void MultiKeyTagFilter::addValues(std::initializer_list<std::string> l)
{
addValues(l.begin(), l.end());
}
示例15:
VertexDescription::VertexDescription(std::initializer_list<VertexDescriptionElement> elements) {
m_elements.resize(elements.size());
std::copy(elements.begin(), elements.end(), m_elements.begin());
}