33 #ifndef MADNESS_WORLD_WORLDRANGE_H__INCLUDED
34 #define MADNESS_WORLD_WORLDRANGE_H__INCLUDED
48 template <
typename iteratorT>
61 Range(
const iterator& start,
const iterator& finish,
int chunk=1)
62 : n(distance(start,finish))
67 if (chunksize < 1) chunksize = 1;
75 , chunksize(r.chunksize)
83 , chunksize(left.chunksize)
85 if (left.n > chunksize) {
86 int nleft = (left.n+1)/2;
112 const iterator&
end()
const {
121 template<
typename integralT,
typename distanceT>
123 advance(integralT& i, distanceT n) { i += n; }
125 template<
typename iterT,
typename distanceT>
126 inline static typename disable_if<std::is_integral<iterT>,
void>::type
127 advance(iterT& it, distanceT n) {
std::advance(it, n); }
129 template<
class integralT>
130 inline static typename enable_if<std::is_integral<integralT>, integralT>::type
131 distance(integralT first, integralT last) {
return last - first; }
133 template <
class iterT>
135 typedef typename std::iterator_traits<iterT>::difference_type type;
138 template<
class iterT>
139 inline static typename lazy_disable_if<std::is_integral<iterT>, diff_type<iterT> >::type
140 distance(iterT first, iterT last) {
return std::distance(first, last); }
145 #endif // MADNESS_WORLD_WORLDRANGE_H__INCLUDED
Range(const iterator &start, const iterator &finish, int chunk=1)
Makes the range [start,finish)
Definition: worldrange.h:61
Dummy class a la Intel TBB used to distinguish splitting constructor.
Definition: worldrange.h:45
const iterator & begin() const
Definition: worldrange.h:108
Grossly simplified Boost-like type traits and templates.
size_t size() const
Returns number of items in the range (cost is O(1))
Definition: worldrange.h:99
Range(const Range &r)
Copy constructor ... cost is O(1)
Definition: worldrange.h:71
unsigned int get_chunksize() const
Definition: worldrange.h:116
Range(Range &left, const Split &)
Splits range between new and old (r) objects ... cost is O(1)
Definition: worldrange.h:79
const iterator & end() const
Definition: worldrange.h:112
int distance(const madness::Hash_private::HashIterator< hashT > &it, const madness::Hash_private::HashIterator< hashT > &jt)
Definition: worldhashmap.h:608
void advance(madness::Hash_private::HashIterator< hashT > &it, const distT &dist)
Definition: worldhashmap.h:602
iteratorT iterator
Definition: worldrange.h:55
bool empty() const
Returns true if size=0.
Definition: worldrange.h:104
Range vaguely a la Intel TBB encapsulates random-access STL-like start and end iterators with chunksi...
Definition: worldrange.h:49
enable_if from Boost for conditionally instantiating templates based on type
Definition: enable_if.h:60
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45