Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
wire-cell-build
util
test
test_randomiter.cxx
Go to the documentation of this file.
1
#include "
WireCellUtil/RandomIter.h
"
2
#include "
WireCellUtil/Testing.h
"
3
4
#include <iostream>
5
#include <vector>
6
7
using namespace
WireCell
;
8
9
int
main
()
10
{
11
typedef
int
value
;
12
typedef
std::vector<value> container;
13
14
container
array
(4);
15
array[0] = 1; array[1] = 2; array[2] = 3; array[3] = 4;
16
17
typedef
RandomIter<container, value>
iterator
;
18
19
iterator beg(array),
end
(
true
,array);
20
for
(iterator it = beg; it !=
end
; ++it) {
21
std::cout << *it <<
std::endl
;
22
}
23
24
beg += 2;
25
std::cout << *beg <<
std::endl
;
26
Assert
(3 == *beg);
27
beg -= 2;
28
std::cout << *beg <<
std::endl
;
29
Assert
(1 == *beg);
30
return
0;
31
}
iterator
intermediate_table::iterator iterator
Definition:
intermediate_table.cc:24
WireCell::RandomIter
Definition:
RandomIter.h:10
Assert
#define Assert
Definition:
Testing.h:7
util::end
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition:
StdUtils.h:72
lar::dump::array
auto array(Array const &a)
Returns a manipulator which will print the specified array.
Definition:
DumpUtils.h:228
Testing.h
main
int main()
Definition:
test_randomiter.cxx:9
RandomIter.h
WireCell
Definition:
Main.h:22
value
const GenericPointer< typename T::ValueType > T2 value
Definition:
pointer.h:1225
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11