本文整理汇总了C++中container_type类的典型用法代码示例。如果您正苦于以下问题:C++ container_type类的具体用法?C++ container_type怎么用?C++ container_type使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了container_type类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: energy
double energy( const container_type &q , const container_type &p , const mass_type &masses )
{
const size_t n = q.size();
double en = 0.0;
for( size_t i=0 ; i<n ; ++i )
{
en += 0.5 * norm( p[i] ) / masses[i];
for( size_t j=0 ; j<i ; ++j )
{
double diff = abs( q[i] - q[j] );
en -= gravitational_constant * masses[j] * masses[i] / diff;
}
}
return en;
}
示例2: calc_mean_field
pair< double , double > calc_mean_field( const container_type &x )
{
size_t n = x.size();
double cos_sum = 0.0 , sin_sum = 0.0;
for( size_t i=0 ; i<n ; ++i )
{
cos_sum += cos( x[i] );
sin_sum += sin( x[i] );
}
cos_sum /= double( n );
sin_sum /= double( n );
double K = sqrt( cos_sum * cos_sum + sin_sum * sin_sum );
double Theta = atan2( sin_sum , cos_sum );
return make_pair( K , Theta );
}
示例3: operator
void operator()( const container_type &q , container_type &dpdt ) const
{
const size_t n = q.size();
for( size_t i=0 ; i<n ; ++i )
{
dpdt[i] = 0.0;
for( size_t j=0 ; j<i ; ++j )
{
point_type diff = q[j] - q[i];
double d = abs( diff );
diff *= ( gravitational_constant * m_masses[i] * m_masses[j] / d / d / d );
dpdt[i] += diff;
dpdt[j] -= diff;
}
}
}
示例4: size
static std::size_t size(const container_type& p) { return p.size(); }
示例5: rend
static const_reverse_iterator rend(const container_type& p) { return p.rend(); }
示例6: rbegin
static const_reverse_iterator rbegin(const container_type& p) { return p.rbegin(); }
示例7: end
static const_iterator end(const container_type& p) { return p.end(); }
示例8: emplace_back
static void emplace_back(container_type& cont, const PointExpr& p) { cont.emplace_back(p); }
示例9: sort
static void sort(container_type<size_t> &front, comparator_type comp) {
std::sort(front.begin(), front.end(), comp);
}
示例10: handle
static typename result_of::const_handle_type<container_type, iterator_handle_tag>::type handle( container_type const & container, value_type const & value )
{
for (typename container_type::const_iterator it = container.begin(); it != container.end(); ++it)
if ( &(*it) == &value ) return it;
return container.end();
}
示例11: set_handle_invalid
void set_handle_invalid( container_type const & container, handle_type & handle, iterator_handle_tag )
{ handle = container.end(); }
示例12: size
typename container_type::size_type size()
{
return m_queue.size();
}
示例13: BigUInt
BigUInt(const container_type& array) :
data(array.begin(), array.end())
{
}
示例14: empty
static bool empty(const container_type& p) { return p.empty(); }
示例15: treader
AsynchronousBufferReaderList(
in_iterator_type ina,
in_iterator_type ine,
uint64_t rnumbuffers = 16,
uint64_t rbufsize = 32,
uint64_t offset = 0)
:
C(ina,ine), ita(C.begin()), ite(C.end()), numbuffers(rnumbuffers), bufsize(rbufsize)
{
while ( ita != ite && offset >= ::libmaus2::util::GetFileSize::getFileSize(*ita) )
{
offset -= ::libmaus2::util::GetFileSize::getFileSize(*ita);
ita++;
}
if ( ita != ite )
{
reader_ptr_type treader(new AsynchronousBufferReader(*ita, numbuffers,bufsize,offset));
reader = UNIQUE_PTR_MOVE(treader);
}
}