Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
iterable-classification-test.cpp
Go to the documentation of this file.
1/*
2 IterableClassification(Test) - detecting iterability of a generic type
3
4 Copyright (C)
5 2010, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
19#include "lib/test/run.hpp"
20
25#include "lib/util-foreach.hpp"
26#include "lib/itertools.hpp"
27
28#include <iostream>
29#include <vector>
30#include <deque>
31#include <list>
32#include <map>
33#include <set>
34
35
36namespace lib {
37namespace meta {
38namespace test {
39
43
44 using std::cout;
45 using std::endl;
46
47
48 namespace { // a custom test container....
49
50
52 {
54
56
57 typedef vector<int>::iterator sourceIter;
59
62 // note: a bare type definition is sufficient here....
63 };
64
65
66
67 }//(End) test containers
68
69#define SHOW_CHECK(_EXPR_) cout << STRINGIFY(_EXPR_) << "\t : " << (_EXPR_::value? "Yes":"No") << endl;
70
71
72
73 /*******************************************************************************/
82 class IterableClassification_test : public Test
83 {
84
85 void
86 run (Arg)
87 {
88 // define a bunch of STL containers
89 typedef std::vector<long> LongVector;
90 typedef std::multiset<Time> TimeSet;
91 typedef std::map<int,char> CharMap;
92 typedef std::list<bool> BoolList;
93 typedef std::deque<ushort> ShortDeque;
94 typedef TestSource CustomCont;
95
96 // some types in compliance to the "Lumiera Forward Iterator" concept
97 typedef TestSource::iterator ForwardRangeIter;
101
102
103 // detect STL iteration
110
115
116 // detect Lumiera Forward Iterator
123
128 }
129 };
130
131
134
135
136
137}}} // namespace lib::meta::test
a mutable time value, behaving like a plain number, allowing copy and re-accessing
Query a scope to discover it's contents or location.
Metaprogramming helpers to check for specific properties of a type in question.
#define SHOW_CHECK(_EXPR_)
unsigned int uint
Definition integral.hpp:29
Helpers for working with iterators based on the pipeline model.
enable_if_c< Cond::value, T >::type enable_if
SFINAE helper to control the visibility of specialisations and overloads.
Definition meta/util.hpp:87
Implementation namespace for support and library code.
Test runner and basic definitions for tests.
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Definition run.hpp:116
Specific queries to explore contents of a scope within the high-level model.
a family of time value like entities and their relationships.
Perform operations "for each element" of a collection.