STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
shuffle_order_engine< _Engine, _Kx > Class Template Reference

Public Types

typedef shuffle_order_engine< _Engine, _Kx > _Myt
 
typedef _Engine base_type
 
typedef _Engine::result_type result_type
 

Public Member Functions

 shuffle_order_engine ()
 
 shuffle_order_engine (const shuffle_order_engine &_Right)
 
 shuffle_order_engine (shuffle_order_engine &_Right)
 
 shuffle_order_engine (const _Engine &_Ex)
 
 shuffle_order_engine (_Engine &_Ex)
 
 shuffle_order_engine (_Engine &&_Ex)
 
 shuffle_order_engine (result_type _X0)
 
template<class _Seed_seq , class = typename enable_if< !is_convertible<_Seed_seq, result_type>::value, void>::type>
 shuffle_order_engine (_Seed_seq &_Seq)
 
void seed ()
 
void seed (result_type _X0)
 
template<class _Seed_seq >
enable_if< !is_convertible< _Seed_seq, result_type >::value, void >::type seed (_Seed_seq &_Seq)
 
const _Engine & base () const _NOEXCEPT
 
result_type operator() ()
 
void discard (unsigned long long _Nskip)
 
template<class _Elem , class _Traits >
basic_istream< _Elem, _Traits > & _Read (basic_istream< _Elem, _Traits > &_Istr)
 
template<class _Elem , class _Traits >
basic_ostream< _Elem, _Traits > & _Write (basic_ostream< _Elem, _Traits > &_Ostr) const
 

Static Public Member Functions

static result_type() min ()
 
static result_type() max ()
 

Static Public Attributes

static const size_t table_size = _Kx
 

Private Member Functions

void _Init ()
 

Private Attributes

_Engine _Eng
 
result_type _Arr [_Kx]
 
result_type _Yx
 
double _Scale
 

Member Typedef Documentation

template<class _Engine, size_t _Kx>
typedef shuffle_order_engine<_Engine, _Kx> shuffle_order_engine< _Engine, _Kx >::_Myt
template<class _Engine, size_t _Kx>
typedef _Engine shuffle_order_engine< _Engine, _Kx >::base_type
template<class _Engine, size_t _Kx>
typedef _Engine::result_type shuffle_order_engine< _Engine, _Kx >::result_type

Constructor & Destructor Documentation

template<class _Engine, size_t _Kx>
shuffle_order_engine< _Engine, _Kx >::shuffle_order_engine ( )
inline
2157  { // construct
2158  _Init();
2159  }
void _Init()
Definition: random:2277
template<class _Engine, size_t _Kx>
shuffle_order_engine< _Engine, _Kx >::shuffle_order_engine ( const shuffle_order_engine< _Engine, _Kx > &  _Right)
inline
2162  { // construct by copying
2163  *this = _Right;
2164  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Engine, size_t _Kx>
shuffle_order_engine< _Engine, _Kx >::shuffle_order_engine ( shuffle_order_engine< _Engine, _Kx > &  _Right)
inline
2167  { // construct by copying
2168  *this = _Right;
2169  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Engine, size_t _Kx>
shuffle_order_engine< _Engine, _Kx >::shuffle_order_engine ( const _Engine &  _Ex)
inlineexplicit
2172  : _Eng(_Ex)
2173  { // construct with engine initializer _Ex
2174  _Init();
2175  }
void _Init()
Definition: random:2277
_Engine _Eng
Definition: random:2286
template<class _Engine, size_t _Kx>
shuffle_order_engine< _Engine, _Kx >::shuffle_order_engine ( _Engine &  _Ex)
inlineexplicit
2178  : _Eng(_Ex)
2179  { // construct with engine initializer _Ex
2180  _Init();
2181  }
void _Init()
Definition: random:2277
_Engine _Eng
Definition: random:2286
template<class _Engine, size_t _Kx>
shuffle_order_engine< _Engine, _Kx >::shuffle_order_engine ( _Engine &&  _Ex)
inlineexplicit
2184  : _Eng(_STD forward<_Engine>(_Ex))
2185  { // construct with engine initializer _Ex
2186  _Init();
2187  }
void _Init()
Definition: random:2277
_Engine _Eng
Definition: random:2286
template<class _Engine, size_t _Kx>
shuffle_order_engine< _Engine, _Kx >::shuffle_order_engine ( result_type  _X0)
inlineexplicit
2190  : _Eng(_X0)
2191  { // construct from specified seed value
2192  _Init();
2193  }
void _Init()
Definition: random:2277
_Engine _Eng
Definition: random:2286
template<class _Engine, size_t _Kx>
template<class _Seed_seq , class = typename enable_if< !is_convertible<_Seed_seq, result_type>::value, void>::type>
shuffle_order_engine< _Engine, _Kx >::shuffle_order_engine ( _Seed_seq &  _Seq)
inlineexplicit
2200  : _Eng(_Seq)
2201  { // construct from seed sequence
2202  _Init();
2203  }
void _Init()
Definition: random:2277
_Engine _Eng
Definition: random:2286

Member Function Documentation

template<class _Engine, size_t _Kx>
void shuffle_order_engine< _Engine, _Kx >::_Init ( )
inlineprivate
2278  { // compute values for operator()
2279  for (size_t _Idx = 0; _Idx < _Kx; ++_Idx)
2280  _Arr[_Idx] = _Eng();
2281  _Yx = _Eng();
2282  _Scale = (double)_Kx
2283  / ((double)(_Eng.max)() - (double)(_Eng.min)() + 1.0);
2284  }
double _Scale
Definition: random:2289
result_type _Arr[_Kx]
Definition: random:2287
result_type _Yx
Definition: random:2288
_Engine _Eng
Definition: random:2286
template<class _Engine, size_t _Kx>
template<class _Elem , class _Traits >
basic_istream<_Elem, _Traits>& shuffle_order_engine< _Engine, _Kx >::_Read ( basic_istream< _Elem, _Traits > &  _Istr)
inline
2258  { // read state from _Istr
2259  _Istr >> _Eng;
2260  for (size_t _Idx = 0; _Idx < _Kx; ++_Idx)
2261  _Istr >> _Arr[_Idx];
2262  return (_Istr >> _Yx);
2263  }
result_type _Arr[_Kx]
Definition: random:2287
result_type _Yx
Definition: random:2288
_Engine _Eng
Definition: random:2286
template<class _Engine, size_t _Kx>
template<class _Elem , class _Traits >
basic_ostream<_Elem, _Traits>& shuffle_order_engine< _Engine, _Kx >::_Write ( basic_ostream< _Elem, _Traits > &  _Ostr) const
inline
2269  { // write state to _Ostr
2270  _Ostr << _Eng;
2271  for (size_t _Idx = 0; _Idx < _Kx; ++_Idx)
2272  _Ostr << ' ' << _Arr[_Idx];
2273  return (_Ostr << ' ' << _Yx);
2274  }
result_type _Arr[_Kx]
Definition: random:2287
result_type _Yx
Definition: random:2288
_Engine _Eng
Definition: random:2286
template<class _Engine, size_t _Kx>
const _Engine& shuffle_order_engine< _Engine, _Kx >::base ( ) const
inline
2225  { // return const reference to engine
2226  return (_Eng);
2227  }
_Engine _Eng
Definition: random:2286
template<class _Engine, size_t _Kx>
void shuffle_order_engine< _Engine, _Kx >::discard ( unsigned long long  _Nskip)
inline
2249  { // discard _Nskip elements
2250  for (; 0 < _Nskip; --_Nskip)
2251  (*this)();
2252  }
template<class _Engine, size_t _Kx>
static result_type() shuffle_order_engine< _Engine, _Kx >::max ( )
inlinestatic
2235  { // return maximum possible generated value
2236  return ((_Engine::max)());
2237  }
#define max(a, b)
Definition: minmax.h:19
template<class _Engine, size_t _Kx>
static result_type() shuffle_order_engine< _Engine, _Kx >::min ( )
inlinestatic
2230  { // return minimum possible generated value
2231  return ((_Engine::min)());
2232  }
#define min(a, b)
Definition: minmax.h:23
template<class _Engine, size_t _Kx>
result_type shuffle_order_engine< _Engine, _Kx >::operator() ( )
inline
2240  { // return next value
2241  size_t _Idx = (size_t)((double)(_Yx - (_Eng.min)()) * _Scale);
2242 
2243  _Yx = _Arr[_Idx];
2244  _Arr[_Idx] = _Eng();
2245  return (_Yx);
2246  }
_W64 unsigned int size_t
Definition: crtdefs.h:496
double _Scale
Definition: random:2289
result_type _Arr[_Kx]
Definition: random:2287
result_type _Yx
Definition: random:2288
_Engine _Eng
Definition: random:2286
template<class _Engine, size_t _Kx>
void shuffle_order_engine< _Engine, _Kx >::seed ( )
inline
2206  { // seed engine from default value
2207  _Eng.seed();
2208  }
_Engine _Eng
Definition: random:2286
template<class _Engine, size_t _Kx>
void shuffle_order_engine< _Engine, _Kx >::seed ( result_type  _X0)
inline
2211  { // seed engine from specified value
2212  _Eng.seed(_X0);
2213  }
_Engine _Eng
Definition: random:2286
template<class _Engine, size_t _Kx>
template<class _Seed_seq >
enable_if< !is_convertible<_Seed_seq, result_type>::value, void>::type shuffle_order_engine< _Engine, _Kx >::seed ( _Seed_seq &  _Seq)
inline
2220  { // seed engine from seed sequence
2221  _Eng.seed(_Seq);
2222  }
_Engine _Eng
Definition: random:2286

Member Data Documentation

template<class _Engine, size_t _Kx>
result_type shuffle_order_engine< _Engine, _Kx >::_Arr[_Kx]
private
template<class _Engine, size_t _Kx>
_Engine shuffle_order_engine< _Engine, _Kx >::_Eng
private
template<class _Engine, size_t _Kx>
double shuffle_order_engine< _Engine, _Kx >::_Scale
private
template<class _Engine, size_t _Kx>
result_type shuffle_order_engine< _Engine, _Kx >::_Yx
private
template<class _Engine, size_t _Kx>
const size_t shuffle_order_engine< _Engine, _Kx >::table_size = _Kx
static

The documentation for this class was generated from the following file: