libpsynth 0.2.1
Functions
static_generate

Equivalent to std::generate. More...

Functions

template<typename P1 , typename Op >
PSYNTH_FORCEINLINE void psynth::sound::static_generate (P1 &dst, Op op)

Detailed Description

Equivalent to std::generate.

Example: Set each sample of a frame to its semantic index. The samples must be assignable from an integer.

   struct consecutive_fn {
     int& _current;
     consecutive_fn(int& start) : _current(start) {}
     int operator()() { return _current++; }
   };
   rgb8_frame_t p;
   int start=0;
   static_generate(p, consecutive_fn(start));
   assert(p == rgb8_frame_t(0,1,2));

Function Documentation

template<typename P1 , typename Op >
PSYNTH_FORCEINLINE void psynth::sound::static_generate ( P1 &  dst,
Op  op 
)