本文整理汇总了C++中container_t类的典型用法代码示例。如果您正苦于以下问题:C++ container_t类的具体用法?C++ container_t怎么用?C++ container_t使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了container_t类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: assert
void UpdaterBoostNoUnits::solar_system_coor::operator()(const container_t& p, container_t& dqdt) const
{
assert(p.size() == m_masses.size());
assert(dqdt.size() == m_masses.size());
const auto n = m_masses.size();
for(size_t i=0 ; i<n ; ++i)
dqdt[i] = p[i] / m_masses[i];
}
开发者ID:julienlopez,项目名称:QSolarSystem,代码行数:8,代码来源:updaterboostnounits.cpp
示例2: write
void write(const std::string& name, const container_t& cont)
{
std::cout << name << ": ";
for( container_t::const_iterator it = cont.begin(); it != cont.end(); ++it )
std::cout << *it << " ";
std::cout << "\n";
}
开发者ID:IwishIcanFLighT,项目名称:Asylum_Tutorials,代码行数:9,代码来源:main.cpp
示例3: oldsize
inline void
pointmesh2d<point_t>::add_row(container_t const& c)
{
std::size_t oldsize(_points.size());
std::copy(c.begin(), c.end(), std::back_inserter(_points));
_width = _points.size() - oldsize;
++_height;
}
开发者ID:scholli,项目名称:gpucast,代码行数:10,代码来源:pointmesh2d_impl.hpp
示例4: set_add
void set_add(container_t& container, typename container_t::value_type value)
{
auto it = container.begin();
while (it != container.end() && *it < value)
{
++it;
}
if (*it != value)
{
container.insert(it, value);
}
}
开发者ID:adkozlov,项目名称:cpp-2014,代码行数:13,代码来源:main.cpp
示例5: sizeof
typename std::enable_if<std::is_class<container_t>::value && sizeof(typename container_t::value_type)!=0
//has_member_function size,
,
const typename container_t::value_type*>::type
end(const container_t& _array){
return &_array[_array.size()];
}
开发者ID:psteinb,项目名称:libmultiviewnative,代码行数:9,代码来源:utils.hpp
示例6: compare
bool compare(container_t const & lhs, container_t const & rhs, typename container_t::value_type precision)
{
if (&lhs == &rhs) {
return true;
}
if (lhs.size() != rhs.size()) {
return false;
}
typename container_t::const_iterator il(lhs.begin());
typename container_t::const_iterator ir(rhs.begin());
typename container_t::const_iterator il_end(lhs.end());
for (/**/; il != il_end; ++il, ++ir) {
if (fabs(*il - *ir) > precision) {
return false;
}
}
return true;
}
开发者ID:digideskio,项目名称:whole_body_control,代码行数:18,代码来源:vector_util.hpp
示例7: convert2
value_t convert2(const container_t& c) {
try {
return c.operator value_t();
}
catch(const std::exception& e) {
OH_FAIL("Unable to convert type '" << c.type().name()
<< "' to type '" << typeid(value_t).name() << "' - " << e.what());
}
}
开发者ID:rdaluiso,项目名称:quantlib,代码行数:9,代码来源:convert2.hpp
示例8: makeWeightedOne
static void makeWeightedOne(float wA,
std::vector<VisibilityVector::node_benefits_pair_t>::const_iterator & a,
std::vector<VisibilityVector::node_benefits_pair_t>::const_iterator & aEnd,
container_t & result) {
// Add the elements of the single map.
while(a != aEnd) {
const VisibilityVector::benefits_t weightedBenefits = (wA * a->second);
if(weightedBenefits > 0) {
result.emplace_back(a->first, weightedBenefits);
}
++a;
}
}
开发者ID:MeisterYeti,项目名称:MinSG,代码行数:13,代码来源:VisibilityVector.cpp
示例9: makeWeightedTwo
static void makeWeightedTwo(float wA,
std::vector<VisibilityVector::node_benefits_pair_t>::const_iterator & a,
std::vector<VisibilityVector::node_benefits_pair_t>::const_iterator & aEnd,
float wB,
std::vector<VisibilityVector::node_benefits_pair_t>::const_iterator & b,
std::vector<VisibilityVector::node_benefits_pair_t>::const_iterator & bEnd,
container_t & result) {
// Compare elements of the two maps.
while(a != aEnd && b != bEnd) {
if(a->first < b->first) { // Object is only in map of vvA.
const VisibilityVector::benefits_t weightedBenefits = (wA * a->second);
if(weightedBenefits > 0) {
result.emplace_back(a->first, weightedBenefits);
}
++a;
} else if(b->first < a->first) { // Object is only in map of vvB.
const VisibilityVector::benefits_t weightedBenefits = (wB * b->second);
if(weightedBenefits > 0) {
result.emplace_back(b->first, weightedBenefits);
}
++b;
} else { // Object is in both maps.
const VisibilityVector::benefits_t weightedBenefits = (wA * a->second + wB * b->second);
if(weightedBenefits > 0) {
result.emplace_back(a->first, weightedBenefits);
}
++a;
++b;
}
}
if(a == aEnd) {
makeWeightedOne(wB, b, bEnd, result);
} else {
makeWeightedOne(wA, a, aEnd, result);
}
}
开发者ID:MeisterYeti,项目名称:MinSG,代码行数:36,代码来源:VisibilityVector.cpp
示例10: zero
void zero(container_t & vv)
{
std::fill(vv.begin(), vv.end(), 0);
}
开发者ID:digideskio,项目名称:whole_body_control,代码行数:4,代码来源:vector_util.hpp
示例11: send
bool socket_t::send(const container_t& message, int flags) {
return send(static_cast<const void*>(message.data()), message.size(), flags);
}
开发者ID:fsaric,项目名称:prime_server,代码行数:3,代码来源:zmq_helpers.cpp
示例12: insert
void insert(const KEY &key, const VALUE &value)
{
erase(key);
const pair_t p(key, value);
auto it = std::lower_bound(m_contents.begin(), m_contents.end(), p);
m_contents.insert(it, p);
}
开发者ID:Weeena,项目名称:ponder,代码行数:7,代码来源:dictionary.hpp
示例13: findKey
const_iterator findKey(const KEY& key) const
{
// binary search for key
const_iterator it(std::lower_bound(m_contents.begin(), m_contents.end(), key, KeyCmp()));
if (it != m_contents.end() && CMP()(key, it->first)) // it > it-1, check ==
it = m_contents.end();
return it;
}
开发者ID:Weeena,项目名称:ponder,代码行数:8,代码来源:dictionary.hpp
示例14: findValue
const_iterator findValue(const VALUE& value) const
{
for (auto&& it = m_contents.begin(); it != m_contents.end(); ++it)
{
if (it->second == value)
return it;
}
return m_contents.end();
}
开发者ID:Weeena,项目名称:ponder,代码行数:9,代码来源:dictionary.hpp
示例15: erase
void erase(const KEY& key)
{
const_iterator it = findKey(key);
if (it != m_contents.end())
{
// Avoid std::vector.erase here due to bug in libstdc++ < v4.9
#if PONDER_WORKAROUND_GCC_N2350
std::size_t pos = it - m_contents.begin();
const std::size_t sz = m_contents.size() - 1;
while (pos < sz)
m_contents[pos] = m_contents[pos + 1], ++pos;
m_contents.resize(sz);
#else
m_contents.erase(it);
#endif
}
}
开发者ID:Weeena,项目名称:ponder,代码行数:17,代码来源:dictionary.hpp
示例16: tryFind
bool tryFind(const KEY& key, const_iterator& returnValue) const
{
const_iterator it = findKey(key);
if (it != m_contents.end())
{
returnValue = it;
return true;
}
return false; // not found
}
开发者ID:Weeena,项目名称:ponder,代码行数:10,代码来源:dictionary.hpp
示例17: reserve
void reserve(size_t size) { __container.reserve(size); }
开发者ID:cvalka4,项目名称:cupt,代码行数:1,代码来源:solution.cpp
示例18: containsValue
bool containsValue(const VALUE& value) const
{
return findValue(value) != m_contents.end();
}
开发者ID:Weeena,项目名称:ponder,代码行数:4,代码来源:dictionary.hpp
示例19: end
const_iterator end() const { return m_contents.end(); }
开发者ID:Weeena,项目名称:ponder,代码行数:1,代码来源:dictionary.hpp
示例20: erase
void erase(const_iterator_t position)
{
__container.erase(__position_to_iterator(position));
}
开发者ID:cvalka4,项目名称:cupt,代码行数:4,代码来源:solution.cpp
注:本文中的container_t类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论