regex_replace fmt(what) Dokumentation
-
Ich habe ein Problem. In der Dokumentation von der boost-Funktion regex_replace wird kurz angeschnitten, dass man eine Funktion als Formatter reinschicken kann. Doch ich habe keinen blassen schimmer wie die Funktionsdeklaration ausehen soll.
Hier der Link zu der Dokumentation: http://www.boost.org/doc/libs/1_42_0/libs/regex/doc/html/boost_regex/ref/regex_replace.html
-
Ich hab' damit zwar noch nicht gearbeitet, aber ich finde die Beschreibung eigentlich eindeutig:
The type Formatter must be either a pointer to a null-terminated string of type char_type[], or be a container of char_type's (for example std::basic_string<char_type>) or be a unary, binary or ternary functor that computes the replacement string from a function call: either fmt(what) which must return a container of char_type's to be used as the replacement text, or either fmt(what, out) or fmt(what, out, flags), both of which write the replacement text to *out, and then return the new OutputIterator position. In each case what is the match_results object that represents the match found.
Außerdem stand, da noch, daß er die gefundenen Texte mit match_results::format() ersetzt - und dort steht auch dabei, was für Funktionen dort erwartet werden (String als Ersatztext, "string fmt(match_results)", "void fmt(match_results,OutIt)" oder "void fmt(match_results,OutIt,match_flag_type)").
-
Danke funktioniert. Ich hatte wohl Tomaten auf den Augen.