Skip to content

Commit c07cec2

Browse files
committed
refactor: deduplicate code used to print version strings
String printing duplicated code from the ostream operator, use that implementation instead to get versions as a strings via buffering to stringstreams.
1 parent 707772d commit c07cec2

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

System/Semver200/version.inl

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,7 @@ namespace version {
6767
template<typename Parser, typename Comparator, typename Modifier>
6868
const std::string Basic_version<Parser, Comparator, Modifier>::str() const {
6969
std::stringstream buffer;
70-
buffer << ver_.major << "." << ver_.minor << "." << ver_.patch;
71-
std::string prl = prerelease();
72-
if (!prl.empty()) {
73-
buffer << "-" << prl;
74-
}
75-
std::string bld = build();
76-
if (!bld.empty()) {
77-
buffer << "+" << bld;
78-
}
70+
buffer << *this;
7971
return buffer.str();
8072
}
8173

0 commit comments

Comments
 (0)