diff --git a/src/lib/format-obj.hpp b/src/lib/format-obj.hpp index a4f7c8a87..31d951adf 100644 --- a/src/lib/format-obj.hpp +++ b/src/lib/format-obj.hpp @@ -168,12 +168,15 @@ namespace util { * by boost::lexical_cast. For double or float values, hard wired * rounding to a fixed number of digits will be performed, to yield * a predictable display of printed unit-test results. + * @remark while the actual parameter is passed by const-ref, + * cv-qualifiactions and references are stripped from the type */ template inline std::string toString (TY const& val) noexcept { - return StringConv::invoke (val); + using PlainVal = typename lib::meta::Strip::TypeReferred; + return StringConv::invoke (val); } diff --git a/src/lib/meta/trait.hpp b/src/lib/meta/trait.hpp index b65dba404..cefed5668 100644 --- a/src/lib/meta/trait.hpp +++ b/src/lib/meta/trait.hpp @@ -146,7 +146,7 @@ namespace meta { struct Unwrap : std::true_type { - using Type = typename std::remove_cv::type; + using Type = remove_cv_t; static Type& extract (const X* ptr) @@ -246,10 +246,10 @@ namespace meta { template struct Strip { - using TypeUnconst = typename std::remove_cv ::type; - using TypeReferred = typename std::remove_reference::type; - using TypePointee = typename std::remove_pointer ::type; - using TypePlain = typename std::remove_cv ::type; + using TypeUnconst = remove_cv_t; + using TypeReferred = remove_reference_t; + using TypePointee = remove_pointer_t; + using TypePlain = remove_cv_t; using Type = typename Unwrap::Type; }; diff --git a/src/lib/meta/util.hpp b/src/lib/meta/util.hpp index c86bb7eff..c64a0e714 100644 --- a/src/lib/meta/util.hpp +++ b/src/lib/meta/util.hpp @@ -347,8 +347,11 @@ namespace util { * the danger of creating much header inclusion and code size bloat. A more * elaborate, [extended solution](\ref lib::toString), including _lexical conversions * for numbers,_ is defined in format-obj.hpp + * @tparam X the nominal type to base the string conversion on; should be + * a plain type (class or value) without CV-qualification and references * @note any exceptions during string conversion are caught and silently ignored; * the returned string indicates "↯" in this case. + * @see util::toString() a user friendly front-end */ template struct StringConv diff --git a/tests/library/format-helper-test.cpp b/tests/library/format-helper-test.cpp index be22577ea..f89777895 100644 --- a/tests/library/format-helper-test.cpp +++ b/tests/library/format-helper-test.cpp @@ -29,6 +29,7 @@ #include "lib/format-util.hpp" #include "lib/format-string.hpp" #include "lib/iter-adapter-stl.hpp" +#include "lib/test/test-helper.hpp" #include "lib/error.hpp" #include @@ -215,7 +216,7 @@ namespace test { "6.6--+--" "7.7--+--" "8.8--+--" - "9.9"); + "9.9"_expect); CHECK (join (transformIterator(eachElm(dubious), justCount)) == "Nr.01(0.0), " "Nr.02(2.2), " @@ -226,7 +227,7 @@ namespace test { "Nr.07(13.2), " "Nr.08(15.4), " "Nr.09(17.6), " - "Nr.10(19.8)" ); + "Nr.10(19.8)"_expect); } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 5c5f36783..9f82ed3f8 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -54407,8 +54407,7 @@ das ist der wichtigste Part: ich grenze mich hier explizit von der STL ab;  ein »Lumiera Forward Iterator« ist nicht eine besondere Art von Pointer — wir wissen sonst wirklich nichts, und wir verzichten auf ein absolut optimale Performance. Und wir bieten keinerlei  weitere Features, wie Rückwärts-Iteration, random-access, Löschen und Einfügen. Einen einmal verbrauchten Iterator kann man nur noch wegwerfen.

- - + @@ -54431,8 +54430,7 @@ offensichtlich habe ich das gleiche Problem hier mehrfach gelöst und das dann wieder vergessen

- - + @@ -70514,10 +70512,10 @@ - - - - + + + + @@ -70534,8 +70532,7 @@ denn diese ist am aller fragwürdigsten

- - + @@ -70607,8 +70604,7 @@ ...was wohl genau daran liegt, daß das TypeBinding bisher konzeptionell "daneben" war

- - +
@@ -70671,8 +70667,7 @@ hier ist ein Hinweis auf TICKET #1125 : get rid of Val

- - +
@@ -70694,17 +70689,57 @@
- + + + + + + + + + + + + + + +

+ analog zu meta::Strip, nur weniger aggressiv +

+
    +
  • + Referenzen werden nivelliert +
  • +
  • + Pointer bleiben ein separater Typ +
  • +
+ +
+ +
+ + + + + + +
+
+ + - + - - + + + + @@ -70724,7 +70759,8 @@ - + + @@ -70744,7 +70780,7 @@ - + @@ -70775,7 +70811,7 @@ - + @@ -70830,7 +70866,7 @@ - + @@ -70858,12 +70894,12 @@ - + - + - + @@ -70888,7 +70924,7 @@ - + @@ -70908,13 +70944,13 @@ - + - + @@ -70961,7 +70997,7 @@ - + @@ -70983,9 +71019,90 @@ + + + + - - + + + + + + +

+ der Double wird nämlich (wohlweislich) für diese Diagnostic-Anzeige auf 8 Stellen gerundet ... genau wegen Probemen wie hier +

+ +
+ + + + + + + + + + +

+ 1 * 1.1 = 1.100000000000000000000000000001 +

+ +
+
+ + + +
+
+ + + + + + + + +

+ konkret: double verhält sich anders als const double oder volatile double +

+ +
+
+ + + + + + + + + + +
    +
  • + lib/meta/util.hpp wird pervasiv verwendet und darf daher nahezu keine weiteren Includes vorraussetzen +
  • +
  • + demgegenüber wiegt lib/meta/trait.hpp schon mehr +
  • +
  • + und die Format-Funktionen können auch Itertools etc. mit includieren (denn sie werden i.d.r. aus der Implementierung heraus verwendet) +
  • +
+ +
+
+
+ + + + +
+
+ + @@ -71036,13 +71153,6 @@ - - - - - - -