32 #ifndef MADNESS_WORLD_RANGE_H__INCLUDED
33 #define MADNESS_WORLD_RANGE_H__INCLUDED
35 #include <type_traits>
38 # include <tbb/partitioner.h>
63 template <
typename iteratorT>
110 int nleft = (left.
n+1)/2;
162 template<
typename integralT,
typename distanceT>
163 inline static typename std::enable_if<std::is_integral<integralT>::value,
void>
::type
173 template<
typename iterT,
typename distanceT>
174 inline static typename std::enable_if<!std::is_integral<iterT>::value,
void>
::type
184 template<
class integralT>
185 inline static typename std::enable_if<std::is_integral<integralT>::value, integralT>
::type
186 distance(integralT first, integralT last) {
return last - first; }
195 template<
class iterT>
198 typename std::enable_if<!std::is_integral<iterT>::value>::
type* =
nullptr)
Range, vaguely a la Intel TBB, to encapsulate a random-access, STL-like start and end iterator with c...
Definition: range.h:64
Range(Range &left, const Split &)
Splits range between new and old (r) objects. Cost is O(1).
Definition: range.h:103
unsigned int get_chunksize() const
Access the chunk size.
Definition: range.h:152
static std::enable_if< std::is_integral< integralT >::value, integralT >::type distance(integralT first, integralT last)
Calculate the distance between two iterators.
Definition: range.h:186
bool is_divisible() const
Return true if this iteration range can be divided; that is, there are more items than the chunk size...
Definition: range.h:146
static auto distance(iterT first, iterT last, typename std::enable_if<!std::is_integral< iterT >::value >::type *=nullptr) -> decltype(std::distance(first, last))
Calculate the distance between two iterators.
Definition: range.h:197
long n
Number of items to iterator over.
Definition: range.h:65
iteratorT iterator
Alias for the iterator type.
Definition: range.h:71
bool empty() const
Returns true if size == 0.
Definition: range.h:130
int chunksize
Number of items to give to each thread/process.
Definition: range.h:68
Range(const iterator &start, const iterator &finish, int chunk=1)
Makes the range [start, finish).
Definition: range.h:80
iteratorT finish
Last item for iteration (first past the end, conventionally).
Definition: range.h:67
iteratorT start
First item for iteration.
Definition: range.h:66
static std::enable_if< std::is_integral< integralT >::value, void >::type advance(integralT &i, distanceT n)
Advance by n elements in the range.
Definition: range.h:164
const iterator & end() const
Access the end.
Definition: range.h:140
static std::enable_if<!std::is_integral< iterT >::value, void >::type advance(iterT &it, distanceT n)
Advance by n elements in the range.
Definition: range.h:175
size_t size() const
Returns the number of items in the range (cost is O(1)).
Definition: range.h:125
const iterator & begin() const
Access the beginning.
Definition: range.h:135
Range(const Range &r)
Copy constructor. Cost is O(1).
Definition: range.h:93
tbb::split Split
Dummy class, a la Intel TBB, used to distinguish splitting constructor.
Definition: range.h:54
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
std::string type(const PairType &n)
Definition: PNOParameters.h:18
void advance(madness::Hash_private::HashIterator< hashT > &it, const distT &dist)
Definition: worldhashmap.h:610
int distance(const madness::Hash_private::HashIterator< hashT > &it, const madness::Hash_private::HashIterator< hashT > &jt)
Definition: worldhashmap.h:616
void split(const Range< ConcurrentHashMap< int, int >::iterator > &range)
Definition: test_hashthreaded.cc:63