32 #ifndef VSMC_SMP_BACKEND_STD_HPP    33 #define VSMC_SMP_BACKEND_STD_HPP    43 template <
typename IntType>
    49     const IntType np = std::max(static_cast<IntType>(1),
    50         static_cast<IntType>(std::thread::hardware_concurrency()));
    57     const IntType m = N / np;
    58     const IntType r = N % np;
    59     for (IntType 
id = 0; 
id != np; ++id) {
    60         const IntType n = m + (
id < r ? 1 : 0);
    61         begin.push_back(
id < r ? n * 
id : (n + 1) * r + n * (
id - r));
    62         end.push_back(begin.back() + n);
    70 template <
typename T, 
typename Derived>
    79         this->eval_pre(iter, particle);
    84         for (std::size_t i = 0; i != begin.size(); ++i) {
    85             const size_type b = begin[i];
    86             const size_type e = end[i];
    87             task_group.push_back(std::async(
    88                 std::launch::async, [
this, iter, &particle, b, e]() {
    89                     return this->eval_range(iter, particle.
range(b, e));
    92         std::size_t accept = 0;
    93         for (
auto &task : task_group)
    95         this->eval_post(iter, particle);
   106 template <
typename T, 
typename Derived>
   112         std::size_t iter, std::size_t dim, 
Particle<T> &particle, 
double *r)
   116         this->eval_pre(iter, particle);
   121         for (std::size_t i = 0; i != begin.size(); ++i) {
   122             const size_type b = begin[i];
   123             const size_type e = end[i];
   124             task_group.push_back(std::async(
   125                 std::launch::async, [
this, iter, dim, &particle, r, b, e]() {
   126                     this->eval_range(iter, dim, particle.
range(b, e),
   127                         r + 
static_cast<std::size_t
>(b) * dim);
   130         for (
auto &task : task_group)
   132         this->eval_post(iter, particle);
   141 template <
typename T, 
typename Derived>
   146 template <
typename T, 
typename Derived>
   151 #endif // VSMC_SMP_BACKEND_STD_HPP std::vector< T, Alloc > Vector
std::vector with Allocator as default allocator 
 
range_type range(size_type begin, size_type end)
Get a ParticleRange<T> object. 
 
Particle class representing the whole particle set. 
 
Monitor evalution base dispatch class. 
 
std::size_t operator()(std::size_t iter, Particle< T > &particle)
 
#define VSMC_DEFINE_SMP_BACKEND_SPECIAL(Impl, Name)                                                  
 
Monitor<T>::eval_type subtype using the standard library. 
 
void backend_std_range(IntType N, vsmc::Vector< IntType > &begin, vsmc::Vector< IntType > &end)
 
Sampler evaluation base dispatch class. 
 
Sampler<T>::eval_type subtype using the standard library. 
 
void operator()(std::size_t iter, std::size_t dim, Particle< T > &particle, double *r)
 
size_type size() const 
Number of particles.