Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
tuple-diagnostics.hpp
Go to the documentation of this file.
1/*
2 TUPLE-DIAGNOSTICS - helper for diagnostics of type tuples
3
4 Copyright (C)
5 2009, 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
14
29#ifndef META_TUPLE_DIAGNOSTICS_H
30#define META_TUPLE_DIAGNOSTICS_H
31
32
35#include "lib/format-string.hpp"
36#include "lib/format-obj.hpp"
37
38#include <string>
39
40using std::string;
41
42
43namespace util {
44
45 template<int i>
46 struct StringConv<lib::meta::Num<i>>
47 {
48 static std::string
50 {
51 static util::_Fmt constElm("(%i)");
52 static util::_Fmt changedElm("{%i}");
53
54 return string( (num.o_==i? constElm:changedElm) % int(num.o_));
55 }
56 };
57
58}
59
60namespace lib {
61namespace meta {
62namespace test {
63
64
65
66 /* ===== printing Tuple types and contents ===== */
67
68
69 template<tuple_like TUP>
70 inline string
71 showType ()
72 {
75
76 return "TUPLE"
77 + DumpPrinter::show();
78 }
79
80 // see the macros DISPLAY and DUMPVAL defined in typelist-diagnostics.hpp
81
82
83
84
85}}} // namespace lib::meta::test
86#endif
A front-end for using printf-style formatting.
Simple functions to represent objects, for debugging and diagnostics.
Front-end for printf-style string template interpolation.
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.
static std::string invoke(lib::meta::Num< i > num) noexcept
failsafe invocation of custom string conversion.
Metaprogramming with tuples-of-types and the std::tuple record.
Support for writing metaprogramming unit-tests dealing with typelists and flags.