Audacity  2.3.1
Classes | Macros | Typedefs | Functions
MemoryX.h File Reference
#include <memory>
#include <cstdlib>
#include <functional>
#include <wx/utils.h>
#include <algorithm>

Go to the source code of this file.

Classes

struct  std::__make_unique_result< X >
 
struct  std::__make_unique_result< X[]>
 
class  ArrayOf< X >
 This simplifies arrays of arrays, each array separately allocated with NEW[] But it might be better to use std::Array<ArrayOf<X>, N> for some small constant N Or use just one array when sub-arrays have a common size and are not large. More...
 
class  ArraysOf< X >
 memory.h template class for making an array of arrays. More...
 
class  Maybe< X >
 Like a smart pointer, allows for object to not exist (nullptr) More...
 
struct  freer
 
struct  Destroyer< T >
 A deleter class to supply the second template parameter of unique_ptr for classes like wxWindow that should be sent a message called Destroy rather than be deleted directly. More...
 
struct  Final_action< F >
 "finally" as in The C++ Programming Language, 4th ed., p. 358 Useful for defining ad-hoc RAII actions. typical usage: auto cleanup = finally([&]{ ... code; ... }); More...
 
struct  RestoreValue< T >
 Structure used by ValueRestorer. More...
 
class  ValueRestorer< T >
 Set a variable temporarily in a scope. More...
 
struct  IteratorRange< Iterator >
 A convenience for use with range-for. More...
 
struct  IteratorRange< Iterator >::identity< T >
 
struct  std::hash< T >
 
struct  std::hash< wxString >
 

Macros

#define safenew   new
 

Typedefs

template<typename T >
using MallocPtr = std::unique_ptr< T, freer >
 
template<typename Character = char>
using MallocString = std::unique_ptr< Character[], freer >
 
template<typename T >
using Destroy_ptr = std::unique_ptr< T, Destroyer< T >>
 a convenience for using Destroyer More...
 

Functions

template<typename X , typename... Args>
__make_unique_result< X >
::scalar_case 
std::make_unique (Args &&...args)
 
template<typename X >
__make_unique_result< X >
::array_case 
std::make_unique (size_t count)
 
template<typename F >
Final_action< F > finally (F f)
 Function template with type deduction lets you construct Final_action without typing any angle brackets. More...
 
template<typename T >
ValueRestorer< T > valueRestorer (T &var)
 inline functions provide convenient parameter type deduction More...
 
template<typename T >
ValueRestorer< T > valueRestorer (T &var, const T &newValue)
 
template<typename Iterator >
IteratorRange< Iterator > make_iterator_range (const Iterator &i1, const Iterator &i2)
 
template<typename Container >
IteratorRange< typename
Container::iterator > 
make_iterator_range (Container &container)
 
template<typename Container >
IteratorRange< typename
Container::const_iterator > 
make_iterator_range (const Container &container)
 

Macro Definition Documentation

#define safenew   new

Definition at line 8 of file MemoryX.h.

Referenced by Maybe< ProgressDialog >::create(), and ArrayOf< MeterUpdateMsg >::reinit().

Typedef Documentation

template<typename T >
using Destroy_ptr = std::unique_ptr<T, Destroyer<T>>

a convenience for using Destroyer

Definition at line 361 of file MemoryX.h.

template<typename T >
using MallocPtr = std::unique_ptr< T, freer >

A useful alias for holding the result of malloc

Definition at line 339 of file MemoryX.h.

template<typename Character = char>
using MallocString = std::unique_ptr< Character[], freer >

A useful alias for holding the result of strup and similar

Definition at line 345 of file MemoryX.h.

Function Documentation

template<typename F >
Final_action<F> finally ( f)

Function template with type deduction lets you construct Final_action without typing any angle brackets.

Definition at line 381 of file MemoryX.h.

382 {
383  return Final_action<F>(f);
384 }
"finally" as in The C++ Programming Language, 4th ed., p. 358 Useful for defining ad-hoc RAII actions...
Definition: MemoryX.h:372
template<typename Iterator >
IteratorRange< Iterator > make_iterator_range ( const Iterator &  i1,
const Iterator &  i2 
)
template<typename Container >
IteratorRange< typename Container::iterator > make_iterator_range ( Container &  container)

Definition at line 615 of file MemoryX.h.

616 {
617  return { container.begin(), container.end() };
618 }
template<typename Container >
IteratorRange< typename Container::const_iterator > make_iterator_range ( const Container &  container)

Definition at line 622 of file MemoryX.h.

623 {
624  return { container.begin(), container.end() };
625 }
template<typename T >
ValueRestorer< T > valueRestorer ( T &  var)
template<typename T >
ValueRestorer< T > valueRestorer ( T &  var,
const T &  newValue 
)

Definition at line 430 of file MemoryX.h.

431 { return ValueRestorer< T >{ var, newValue }; }
Set a variable temporarily in a scope.
Definition: MemoryX.h:403