Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
wire-cell-build
iface
test
test_fret.cxx
Go to the documentation of this file.
1
#include <iostream>
2
#include <functional>
3
#include <random>
4
5
typedef
std::function<int()>
intsrc_t
;
6
7
struct
MyIntFunc
{
8
int
number
= 0;
9
MyIntFunc
(
int
n
=0) : number(
n
) {}
10
int
operator()
() {
return
number
; }
11
};
12
13
intsrc_t
return_a_func
()
14
{
15
MyIntFunc
mif(42);
16
return
mif;
17
}
18
19
void
take_a_func
(
intsrc_t
f
)
20
{
21
std::cerr <<
f
() <<
std::endl
;
22
}
23
24
std::default_random_engine
make_a_generator
()
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
}
31
std::default_random_engine
take_a_generator
(std::default_random_engine
generator
)
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
}
37
38
int
main
()
39
{
40
MyIntFunc
f
(666);
41
take_a_func
(f);
42
43
intsrc_t
f2
=
return_a_func
();
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
}
return_a_func
intsrc_t return_a_func()
Definition:
test_fret.cxx:13
take_a_func
void take_a_func(intsrc_t f)
Definition:
test_fret.cxx:19
keras_to_tensorflow.f
f
Definition:
keras_to_tensorflow.py:162
main
int main()
Definition:
test_fret.cxx:38
larg4::f2
SynchrotronAndGN f2
Definition:
CustomPhysicsBuiltIns.cxx:11
MyIntFunc::operator()
int operator()()
Definition:
test_fret.cxx:10
MyIntFunc::number
int number
Definition:
test_fret.cxx:8
take_a_generator
std::default_random_engine take_a_generator(std::default_random_engine generator)
Definition:
test_fret.cxx:31
train.generator
generator
Definition:
train.py:468
MyIntFunc::MyIntFunc
MyIntFunc(int n=0)
Definition:
test_fret.cxx:9
MyIntFunc
Definition:
test_fret.cxx:7
intsrc_t
std::function< int()> intsrc_t
Definition:
test_fret.cxx:5
make_a_generator
std::default_random_engine make_a_generator()
Definition:
test_fret.cxx:24
n
std::size_t n
Definition:
format.h:3399
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11