Audacity  3.0.3
MemoryX.h
Go to the documentation of this file.
1 #ifndef __AUDACITY_MEMORY_X_H__
2 #define __AUDACITY_MEMORY_X_H__
3 
4 // C++ standard header <memory> with a few extensions
5 #include <iterator>
6 #include <memory>
7 #include <new> // align_val_t and hardware_destructive_interference_size
8 #include <cstdlib> // Needed for free.
9 #ifndef safenew
10 #define safenew new
11 #endif
12 
13 #include <functional>
14 #include <limits>
15 
16 /*
17  * ArrayOf<X>
18  * Not to be confused with std::array (which takes a fixed size) or std::vector
19  * This maintains a pointer allocated by NEW X[]. It's cheap: only one pointer,
20  * with no size and capacity information for resizing as for vector, and if X is
21  * a built-in numeric or pointer type, by default there is no zero filling at
22  * allocation time.
23  */
24 
25 template<typename X>
26 class ArrayOf : public std::unique_ptr<X[]>
27 {
28 public:
29  ArrayOf() {}
30 
31  template<typename Integral>
32  explicit ArrayOf(Integral count, bool initialize = false)
33  {
34  static_assert(std::is_unsigned<Integral>::value, "Unsigned arguments only");
35  reinit(count, initialize);
36  }
37 
38  //ArrayOf(const ArrayOf&) PROHIBITED;
39  ArrayOf(const ArrayOf&) = delete;
40  ArrayOf(ArrayOf&& that)
41  : std::unique_ptr < X[] >
42  (std::move((std::unique_ptr < X[] >&)(that)))
43  {
44  }
46  {
47  std::unique_ptr<X[]>::operator=(std::move(that));
48  return *this;
49  }
50  ArrayOf& operator= (std::unique_ptr<X[]> &&that)
51  {
52  std::unique_ptr<X[]>::operator=(std::move(that));
53  return *this;
54  }
55 
56  template< typename Integral >
57  void reinit(Integral count,
58  bool initialize = false)
59  {
60  static_assert(std::is_unsigned<Integral>::value, "Unsigned arguments only");
61  if (initialize)
62  // Initialize elements (usually, to zero for a numerical type)
63  std::unique_ptr<X[]>::reset(safenew X[count]{});
64  else
65  // Avoid the slight initialization overhead
66  std::unique_ptr<X[]>::reset(safenew X[count]);
67  }
68 };
69 
79 template<typename X>
80 class ArraysOf : public ArrayOf<ArrayOf<X>>
81 {
82 public:
83  ArraysOf() {}
84 
85  template<typename Integral>
86  explicit ArraysOf(Integral N)
87  : ArrayOf<ArrayOf<X>>( N )
88  {}
89 
90  template<typename Integral1, typename Integral2 >
91  ArraysOf(Integral1 N, Integral2 M, bool initialize = false)
92  : ArrayOf<ArrayOf<X>>( N )
93  {
94  static_assert(std::is_unsigned<Integral1>::value, "Unsigned arguments only");
95  static_assert(std::is_unsigned<Integral2>::value, "Unsigned arguments only");
96  for (size_t ii = 0; ii < N; ++ii)
97  (*this)[ii] = ArrayOf<X>{ M, initialize };
98  }
99 
100  //ArraysOf(const ArraysOf&) PROHIBITED;
101  ArraysOf(const ArraysOf&) =delete;
103  {
104  ArrayOf<ArrayOf<X>>::operator=(std::move(that));
105  return *this;
106  }
107 
108  template< typename Integral >
109  void reinit(Integral count)
110  {
111  ArrayOf<ArrayOf<X>>::reinit( count );
112  }
113 
114  template< typename Integral >
115  void reinit(Integral count, bool initialize)
116  {
117  ArrayOf<ArrayOf<X>>::reinit( count, initialize );
118  }
119 
120  template<typename Integral1, typename Integral2 >
121  void reinit(Integral1 countN, Integral2 countM, bool initialize = false)
122  {
123  static_assert(std::is_unsigned<Integral1>::value, "Unsigned arguments only");
124  static_assert(std::is_unsigned<Integral2>::value, "Unsigned arguments only");
125  reinit(countN, false);
126  for (size_t ii = 0; ii < countN; ++ii)
127  (*this)[ii].reinit(countM, initialize);
128  }
129 };
130 
143 template<typename X>
144 class Optional {
145 public:
146 
147  using value_type = X;
148 
149  // Construct as NULL
150  Optional() {}
151 
152  // Supply the copy and move, so you might use this as a class member too
153  Optional(const Optional &that)
154  {
155  if (that)
156  emplace(*that);
157  }
158 
160  {
161  if (this != &that) {
162  if (that)
163  emplace(*that);
164  else
165  reset();
166  }
167  return *this;
168  }
169 
171  {
172  if (that)
173  emplace(::std::move(*that));
174  }
175 
177  {
178  if (this != &that) {
179  if (that)
180  emplace(::std::move(*that));
181  else
182  reset();
183  }
184  return *this;
185  }
186 
192  template<typename... Args>
193  X& emplace(Args&&... args)
194  {
195  // Lose any old value
196  reset();
197  // emplace NEW value
198  pp = safenew(address()) X(std::forward<Args>(args)...);
199  return **this;
200  }
201 
202  // Destroy any object that was built in it
204  {
205  reset();
206  }
207 
208  // Pointer-like operators
209 
211  X &operator* () const
212  {
213  return *pp;
214  }
215 
216  X *operator-> () const
217  {
218  return pp;
219  }
220 
221  void reset()
222  {
223  if (pp)
224  pp->~X(), pp = nullptr;
225  }
226 
227  // So you can say if(ptr)
228  explicit operator bool() const
229  {
230  return pp != nullptr;
231  }
232 
233  bool has_value() const
234  {
235  return pp != nullptr;
236  }
237 
238 private:
239  X* address()
240  {
241  return reinterpret_cast<X*>(&storage);
242  }
243 
244  // Data
245 #if 0
246  typename ::std::aligned_storage<
247  sizeof(X)
248  // , alignof(X) // Not here yet in all compilers
249  >::type storage{};
250 #else
251  union {
252  double d;
253  char storage[sizeof(X)];
254  };
255 #endif
256  X* pp{ nullptr };
257 };
258 
262 struct freer { void operator() (void *p) const { free(p); } };
263 
267 template< typename T >
268 using MallocPtr = std::unique_ptr< T, freer >;
269 
273 template <typename Character = char>
274 using MallocString = std::unique_ptr< Character[], freer >;
275 
281 template <typename T>
282 struct Destroyer {
283  void operator () (T *p) const { if (p) p->Destroy(); }
284 };
285 
289 template <typename T>
290 using Destroy_ptr = std::unique_ptr<T, Destroyer<T>>;
291 
299 // Construct this from any copyable function object, such as a lambda
300 template <typename F>
301 struct Final_action {
302  Final_action(F f) : clean( f ) {}
304  F clean;
305 };
306 
309 template <typename F>
310 Final_action<F> finally (F f)
311 {
312  return Final_action<F>(f);
313 }
314 
315 #include <algorithm>
316 
320 template< typename T >
321 struct RestoreValue {
323  void operator () ( T *p ) const { if (p) *p = oldValue; }
324 };
325 
326 
330 template< typename T >
331 class ValueRestorer : public std::unique_ptr< T, RestoreValue<T> >
332 {
333  using std::unique_ptr< T, RestoreValue<T> >::reset; // make private
334  // But release() remains public and can be useful to commit a changed value
335 public:
336  explicit ValueRestorer( T &var )
337  : std::unique_ptr< T, RestoreValue<T> >( &var, { var } )
338  {}
339  explicit ValueRestorer( T &var, const T& newValue )
340  : std::unique_ptr< T, RestoreValue<T> >( &var, { var } )
341  { var = newValue; }
343  : std::unique_ptr < T, RestoreValue<T> > ( std::move(that) ) {};
345  {
346  if (this != &that)
347  std::unique_ptr < T, RestoreValue<T> >::operator=(std::move(that));
348  return *this;
349  }
350 };
351 
353 template< typename T >
355 { return ValueRestorer< T >{ var }; }
356 
357 template< typename T >
358 ValueRestorer< T > valueRestorer( T& var, const T& newValue )
359 { return ValueRestorer< T >{ var, newValue }; }
360 
365 template< typename Value, typename Category = std::forward_iterator_tag >
367  using iterator_category = Category;
368  using value_type = Value;
369  using difference_type = ptrdiff_t;
370  // void pointer type so that operator -> is disabled
371  using pointer = void;
372  // make "reference type" really the same as the value type
373  using reference = const Value;
374 };
375 
379 template <typename Iterator>
380 struct IteratorRange : public std::pair<Iterator, Iterator> {
381  using iterator = Iterator;
382  using reverse_iterator = std::reverse_iterator<Iterator>;
383 
384  IteratorRange (const Iterator &a, const Iterator &b)
385  : std::pair<Iterator, Iterator> ( a, b ) {}
386 
387  IteratorRange (Iterator &&a, Iterator &&b)
388  : std::pair<Iterator, Iterator> ( std::move(a), std::move(b) ) {}
389 
391  { return { this->rbegin(), this->rend() }; }
392 
393  Iterator begin() const { return this->first; }
394  Iterator end() const { return this->second; }
395 
396  reverse_iterator rbegin() const { return reverse_iterator{ this->second }; }
397  reverse_iterator rend() const { return reverse_iterator{ this->first }; }
398 
399  bool empty() const { return this->begin() == this->end(); }
400  explicit operator bool () const { return !this->empty(); }
401  size_t size() const { return std::distance(this->begin(), this->end()); }
402 
403  template <typename T> iterator find(const T &t) const
404  { return std::find(this->begin(), this->end(), t); }
405 
406  template <typename T> long index(const T &t) const
407  {
408  auto iter = this->find(t);
409  if (iter == this->end())
410  return -1;
411  return std::distance(this->begin(), iter);
412  }
413 
414  template <typename T> bool contains(const T &t) const
415  { return this->end() != this->find(t); }
416 
417  template <typename F> iterator find_if(const F &f) const
418  { return std::find_if(this->begin(), this->end(), f); }
419 
420  template <typename F> long index_if(const F &f) const
421  {
422  auto iter = this->find_if(f);
423  if (iter == this->end())
424  return -1;
425  return std::distance(this->begin(), iter);
426  }
427 
428  // to do: use std::all_of, any_of, none_of when available on all platforms
429  template <typename F> bool all_of(const F &f) const
430  {
431  auto notF =
432  [&](typename std::iterator_traits<Iterator>::reference v)
433  { return !f(v); };
434  return !this->any_of( notF );
435  }
436 
437  template <typename F> bool any_of(const F &f) const
438  { return this->end() != this->find_if(f); }
439 
440  template <typename F> bool none_of(const F &f) const
441  { return !this->any_of(f); }
442 
443  template<typename T> struct identity
444  { const T&& operator () (T &&v) const { return std::forward(v); } };
445 
446  // Like std::accumulate, but the iterators implied, and with another
447  // unary operation on the iterator value, pre-composed
448  template<
449  typename R,
450  typename Binary = std::plus< R >,
451  typename Unary = identity< decltype( *std::declval<Iterator>() ) >
452  >
454  R init,
455  Binary binary_op = {},
456  Unary unary_op = {}
457  ) const
458  {
459  R result = init;
460  for (auto&& v : *this)
461  result = binary_op(result, unary_op(v));
462  return result;
463  }
464 
465  // An overload making it more convenient to use with pointers to member
466  // functions
467  template<
468  typename R,
469  typename Binary = std::plus< R >,
470  typename R2, typename C
471  >
473  R init,
474  Binary binary_op,
475  R2 (C :: * pmf) () const
476  ) const
477  {
478  return this->accumulate( init, binary_op, std::mem_fn( pmf ) );
479  }
480 
481  // Some accumulations frequent enough to be worth abbreviation:
482  template<
483  typename Unary = identity< decltype( *std::declval<Iterator>() ) >,
484  typename R = decltype( std::declval<Unary>()( *std::declval<Iterator>() ) )
485  >
486  R min( Unary unary_op = {} ) const
487  {
488  return this->accumulate(
489  std::numeric_limits< R >::max(),
490  (const R&(*)(const R&, const R&)) std::min,
491  unary_op
492  );
493  }
494 
495  template<
496  typename R2, typename C,
497  typename R = R2
498  >
499  R min( R2 (C :: * pmf) () const ) const
500  {
501  return this->min( std::mem_fn( pmf ) );
502  }
503 
504  template<
505  typename Unary = identity< decltype( *std::declval<Iterator>() ) >,
506  typename R = decltype( std::declval<Unary>()( *std::declval<Iterator>() ) )
507  >
508  R max( Unary unary_op = {} ) const
509  {
510  return this->accumulate(
511  std::numeric_limits< R >::lowest(),
512  (const R&(*)(const R&, const R&)) std::max,
513  unary_op
514  );
515  }
516 
517  template<
518  typename R2, typename C,
519  typename R = R2
520  >
521  R max( R2 (C :: * pmf) () const ) const
522  {
523  return this->max( std::mem_fn( pmf ) );
524  }
525 
526  template<
527  typename Unary = identity< decltype( *std::declval<Iterator>() ) >,
528  typename R = decltype( std::declval<Unary>()( *std::declval<Iterator>() ) )
529  >
530  R sum( Unary unary_op = {} ) const
531  {
532  return this->accumulate(
533  R{ 0 },
534  std::plus< R >{},
535  unary_op
536  );
537  }
538 
539  template<
540  typename R2, typename C,
541  typename R = R2
542  >
543  R sum( R2 (C :: * pmf) () const ) const
544  {
545  return this->sum( std::mem_fn( pmf ) );
546  }
547 };
548 
549 template< typename Iterator>
551 make_iterator_range( const Iterator &i1, const Iterator &i2 )
552 {
553  return { i1, i2 };
554 }
555 
556 template< typename Container >
558 make_iterator_range( Container &container )
559 {
560  return { container.begin(), container.end() };
561 }
562 
563 template< typename Container >
565 make_iterator_range( const Container &container )
566 {
567  return { container.begin(), container.end() };
568 }
569 
570 // A utility function building a container of results
571 template< typename Container, typename Iterator, typename Function >
572 Container transform_range( Iterator first, Iterator last, Function &&fn )
573 {
574  Container result;
575  std::transform( first, last, std::back_inserter( result ), fn );
576  return result;
577 }
578 // A utility function, often constructing a vector from another vector
579 template< typename OutContainer, typename InContainer, typename Function >
580 OutContainer transform_container( InContainer &inContainer, Function &&fn )
581 {
582  return transform_range<OutContainer>(
583  inContainer.begin(), inContainer.end(), fn );
584 }
585 
587 
591 struct UTILITY_API alignas(
592 #ifdef __WIN32__
593  std::hardware_destructive_interference_size
594 #else
595  // That constant isn't defined for the other builds yet
596  64 /* ? */
597 #endif
598 )
599 
600 NonInterferingBase {
601  static void *operator new(std::size_t count, std::align_val_t al);
602  static void operator delete(void *ptr, std::align_val_t al);
603 
604 #if defined (_MSC_VER) && defined(_DEBUG)
605  // Versions that work in the presence of the DEBUG_NEW macro.
606  // Ignore the arguments supplied by the macro and forward to the
607  // other overloads.
608  static void *operator new(
609  std::size_t count, std::align_val_t al, int, const char *, int)
610  { return operator new(count, al); }
611  static void operator delete(
612  void *ptr, std::align_val_t al, int, const char *, int)
613  { return operator delete(ptr, al); }
614 #endif
615 };
616 
620 template< typename T > struct NonInterfering
621  : NonInterferingBase // Inherit operators; use empty base class optimization
622  , T
623 {
624  using T::T;
625 };
626 
627 // These macros are used widely, so declared here.
628 #define QUANTIZED_TIME(time, rate) (floor(((double)(time) * (rate)) + 0.5) / (rate))
629 // dB - linear amplitude conversions
630 #define DB_TO_LINEAR(x) (pow(10.0, (x) / 20.0))
631 #define LINEAR_TO_DB(x) (20.0 * log10(x))
632 
633 #define MAX_AUDIO (1. - 1./(1<<15))
634 
635 #endif // __AUDACITY_MEMORY_X_H__
IteratorRange::identity
Definition: MemoryX.h:444
transform_range
Container transform_range(Iterator first, Iterator last, Function &&fn)
Definition: MemoryX.h:572
Optional::emplace
X & emplace(Args &&... args)
Definition: MemoryX.h:193
IteratorRange::any_of
bool any_of(const F &f) const
Definition: MemoryX.h:437
Final_action::clean
F clean
Definition: MemoryX.h:304
Optional::Optional
Optional(const Optional &that)
Definition: MemoryX.h:153
Optional::Optional
Optional(Optional &&that)
Definition: MemoryX.h:170
valueRestorer
ValueRestorer< T > valueRestorer(T &var)
inline functions provide convenient parameter type deduction
Definition: MemoryX.h:354
ArraysOf::operator=
ArraysOf & operator=(ArraysOf &&that)
Definition: MemoryX.h:102
ArraysOf::ArraysOf
ArraysOf(Integral N)
Definition: MemoryX.h:86
make_iterator_range
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
Definition: MemoryX.h:551
Optional
Like a smart pointer, allows for object to not exist (nullptr)
Definition: MemoryX.h:144
IteratorRange::max
R max(R2(C ::*pmf)() const) const
Definition: MemoryX.h:521
Optional::Optional
Optional()
Definition: MemoryX.h:150
fn
static const auto fn
Definition: WaveformView.cpp:1108
Final_action::Final_action
Final_action(F f)
Definition: MemoryX.h:302
ArraysOf::ArraysOf
ArraysOf()
Definition: MemoryX.h:83
CommandSignature
Class that maps parameter names to default values and validators.
Definition: CommandSignature.h:29
ArrayOf::reinit
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:57
IteratorRange
A convenience for use with range-for.
Definition: MemoryX.h:380
alignas
struct UTILITY_API alignas(64) NonInterferingBase
Non-template helper for class template NonInterfering.
Definition: MemoryX.h:591
ValueIterator< TrackType *, std::bidirectional_iterator_tag >::difference_type
ptrdiff_t difference_type
Definition: MemoryX.h:369
Optional::address
X * address()
Definition: MemoryX.h:239
MallocString
std::unique_ptr< Character[], freer > MallocString
Definition: MemoryX.h:274
Final_action
"finally" as in The C++ Programming Language, 4th ed., p. 358 Useful for defining ad-hoc RAII actions...
Definition: MemoryX.h:301
RestoreValue::oldValue
T oldValue
Definition: MemoryX.h:322
IteratorRange::rend
reverse_iterator rend() const
Definition: MemoryX.h:397
Optional::storage
char storage[sizeof(X)]
Definition: MemoryX.h:253
ArraysOf::reinit
void reinit(Integral1 countN, Integral2 countM, bool initialize=false)
Definition: MemoryX.h:121
Destroyer
A deleter class to supply the second template parameter of unique_ptr for classes like wxWindow that ...
Definition: MemoryX.h:282
transform_container
OutContainer transform_container(InContainer &inContainer, Function &&fn)
Definition: MemoryX.h:580
Optional::has_value
bool has_value() const
Definition: MemoryX.h:233
Optional::~Optional
~Optional()
Definition: MemoryX.h:203
IteratorRange::begin
Iterator begin() const
Definition: MemoryX.h:393
Optional::reset
void reset()
Definition: MemoryX.h:221
ValueIterator< TrackType *, std::bidirectional_iterator_tag >::reference
const TrackType * reference
Definition: MemoryX.h:373
IteratorRange::min
R min(R2(C ::*pmf)() const) const
Definition: MemoryX.h:499
Optional::d
double d
Definition: MemoryX.h:252
IteratorRange::max
R max(Unary unary_op={}) const
Definition: MemoryX.h:508
ArraysOf::reinit
void reinit(Integral count)
Definition: MemoryX.h:109
IteratorRange::empty
bool empty() const
Definition: MemoryX.h:399
IteratorRange::iterator
Iterator iterator
Definition: MemoryX.h:381
ArrayOf::ArrayOf
ArrayOf()
Definition: MemoryX.h:29
IteratorRange::end
Iterator end() const
Definition: MemoryX.h:394
RestoreValue
Structure used by ValueRestorer.
Definition: MemoryX.h:321
ArraysOf::ArraysOf
ArraysOf(Integral1 N, Integral2 M, bool initialize=false)
Definition: MemoryX.h:91
ArraysOf
memory.h template class for making an array of arrays.
Definition: MemoryX.h:81
ArraysOf::reinit
void reinit(Integral count, bool initialize)
Definition: MemoryX.h:115
Destroyer::operator()
void operator()(T *p) const
Definition: MemoryX.h:283
RestoreValue::operator()
void operator()(T *p) const
Definition: MemoryX.h:323
IteratorRange::reverse_iterator
std::reverse_iterator< Iterator > reverse_iterator
Definition: MemoryX.h:382
ValueIterator< TrackType *, std::bidirectional_iterator_tag >::pointer
void pointer
Definition: MemoryX.h:371
ArrayOf::operator=
ArrayOf & operator=(ArrayOf &&that)
Definition: MemoryX.h:45
IteratorRange::identity::operator()
const T && operator()(T &&v) const
Definition: MemoryX.h:444
Optional::operator->
X * operator->() const
Definition: MemoryX.h:216
ValueRestorer::ValueRestorer
ValueRestorer(ValueRestorer &&that)
Definition: MemoryX.h:342
Optional::operator=
Optional & operator=(const Optional &that)
Definition: MemoryX.h:159
IteratorRange::index_if
long index_if(const F &f) const
Definition: MemoryX.h:420
ValueRestorer::ValueRestorer
ValueRestorer(T &var)
Definition: MemoryX.h:336
IteratorRange::all_of
bool all_of(const F &f) const
Definition: MemoryX.h:429
freer::operator()
void operator()(void *p) const
Definition: MemoryX.h:262
IteratorRange::find
iterator find(const T &t) const
Definition: MemoryX.h:403
IteratorRange::reversal
IteratorRange< reverse_iterator > reversal() const
Definition: MemoryX.h:390
IteratorRange::IteratorRange
IteratorRange(Iterator &&a, Iterator &&b)
Definition: MemoryX.h:387
IteratorRange::sum
R sum(R2(C ::*pmf)() const) const
Definition: MemoryX.h:543
MallocPtr
std::unique_ptr< T, freer > MallocPtr
Definition: MemoryX.h:268
ValueIterator< TrackType *, std::bidirectional_iterator_tag >::value_type
TrackType * value_type
Definition: MemoryX.h:368
ArrayOf::ArrayOf
ArrayOf(ArrayOf &&that)
Definition: MemoryX.h:40
freer
Definition: MemoryX.h:262
IteratorRange::accumulate
R accumulate(R init, Binary binary_op, R2(C ::*pmf)() const) const
Definition: MemoryX.h:472
NonInterfering
Definition: MemoryX.h:623
IteratorRange::rbegin
reverse_iterator rbegin() const
Definition: MemoryX.h:396
Final_action::~Final_action
~Final_action()
Definition: MemoryX.h:303
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
IteratorRange::contains
bool contains(const T &t) const
Definition: MemoryX.h:414
Optional::operator*
X & operator*() const
Dereference, with the usual bad consequences if NULL.
Definition: MemoryX.h:211
ValueIterator
A convenience for defining iterators that return rvalue types, so that they cooperate correctly with ...
Definition: MemoryX.h:366
IteratorRange::min
R min(Unary unary_op={}) const
Definition: MemoryX.h:486
ValueIterator< TrackType *, std::bidirectional_iterator_tag >::iterator_category
std::bidirectional_iterator_tag iterator_category
Definition: MemoryX.h:367
ValueRestorer
Set a variable temporarily in a scope.
Definition: MemoryX.h:332
IteratorRange::accumulate
R accumulate(R init, Binary binary_op={}, Unary unary_op={}) const
Definition: MemoryX.h:453
IteratorRange::size
size_t size() const
Definition: MemoryX.h:401
ValueRestorer::ValueRestorer
ValueRestorer(T &var, const T &newValue)
Definition: MemoryX.h:339
ArrayOf::ArrayOf
ArrayOf(const ArrayOf &)=delete
Optional::pp
X * pp
Definition: MemoryX.h:256
IteratorRange::sum
R sum(Unary unary_op={}) const
Definition: MemoryX.h:530
Destroy_ptr
std::unique_ptr< T, Destroyer< T > > Destroy_ptr
a convenience for using Destroyer
Definition: MemoryX.h:290
safenew
#define safenew
Definition: MemoryX.h:10
ArrayOf::ArrayOf
ArrayOf(Integral count, bool initialize=false)
Definition: MemoryX.h:32
IteratorRange::IteratorRange
IteratorRange(const Iterator &a, const Iterator &b)
Definition: MemoryX.h:384
IteratorRange::index
long index(const T &t) const
Definition: MemoryX.h:406
ArrayOf
Memory.h template class for making an array of float, bool, etc.
Definition: MemoryX.h:27
ArraysOf::ArraysOf
ArraysOf(const ArraysOf &)=delete
ValueRestorer::operator=
ValueRestorer & operator=(ValueRestorer &&that)
Definition: MemoryX.h:344
IteratorRange::find_if
iterator find_if(const F &f) const
Definition: MemoryX.h:417
IteratorRange::none_of
bool none_of(const F &f) const
Definition: MemoryX.h:440