Classes | Typedefs | Functions
test_fret.cxx File Reference
#include <iostream>
#include <functional>
#include <random>

Go to the source code of this file.

Classes

struct  MyIntFunc
 

Typedefs

typedef std::function< int()> intsrc_t
 

Functions

intsrc_t return_a_func ()
 
void take_a_func (intsrc_t f)
 
std::default_random_engine make_a_generator ()
 
std::default_random_engine take_a_generator (std::default_random_engine generator)
 
int main ()
 

Typedef Documentation

typedef std::function<int()> intsrc_t

Definition at line 5 of file test_fret.cxx.

Function Documentation

int main ( void  )

Definition at line 38 of file test_fret.cxx.

39 {
40  MyIntFunc f(666);
41  take_a_func(f);
42 
44  take_a_func(f2);
45 
46  std::default_random_engine generator = make_a_generator();
47  std::uniform_real_distribution<double> distribution(0.0,1.0);
48  std::cerr << "Used generator with " << distribution(generator) << std::endl;
49  generator = take_a_generator(generator);
50  std::cerr << "Copy generator with " << distribution(generator) << std::endl;
51  generator = take_a_generator(generator);
52  std::cerr << "Copy generator with " << distribution(generator) << std::endl;
53 }
intsrc_t return_a_func()
Definition: test_fret.cxx:13
void take_a_func(intsrc_t f)
Definition: test_fret.cxx:19
SynchrotronAndGN f2
std::default_random_engine take_a_generator(std::default_random_engine generator)
Definition: test_fret.cxx:31
generator
Definition: train.py:468
std::function< int()> intsrc_t
Definition: test_fret.cxx:5
std::default_random_engine make_a_generator()
Definition: test_fret.cxx:24
QTextStream & endl(QTextStream &s)
std::default_random_engine make_a_generator ( )

Definition at line 24 of file test_fret.cxx.

25 {
26  std::default_random_engine generator(42);
27  std::uniform_real_distribution<double> distribution(0.0,1.0);
28  std::cerr << "Made generator with " << distribution(generator) << std::endl;
29  return generator;
30 }
generator
Definition: train.py:468
QTextStream & endl(QTextStream &s)
intsrc_t return_a_func ( )

Definition at line 13 of file test_fret.cxx.

14 {
15  MyIntFunc mif(42);
16  return mif;
17 }
void take_a_func ( intsrc_t  f)

Definition at line 19 of file test_fret.cxx.

20 {
21  std::cerr << f() << std::endl;
22 }
QTextStream & endl(QTextStream &s)
std::default_random_engine take_a_generator ( std::default_random_engine  generator)

Definition at line 31 of file test_fret.cxx.

32 {
33  std::uniform_real_distribution<double> distribution(0.0,1.0);
34  std::cerr << "Take generator with " << distribution(generator) << std::endl;
35  return generator;
36 }
generator
Definition: train.py:468
QTextStream & endl(QTextStream &s)