Skip to content

Commit 7ee920f

Browse files
Update Errata methods to return a r-value when called on an r-value.
1 parent 27dbd4f commit 7ee920f

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

code/include/swoc/Errata.h

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,17 @@ class Errata {
209209
self_type &note(self_type &&that);
210210

211211
/// Overload for @c DIAG severity notes.
212-
template <typename... Args> self_type &diag(std::string_view fmt, Args &&... args);
212+
template <typename... Args> self_type &diag(std::string_view fmt, Args &&... args) &;
213+
template <typename... Args> self_type diag(std::string_view fmt, Args &&... args) &&;
213214
/// Overload for @c INFO severity notes.
214-
template <typename... Args> self_type &info(std::string_view fmt, Args &&... args);
215+
template <typename... Args> self_type &info(std::string_view fmt, Args &&... args)&;
216+
template <typename... Args> self_type info(std::string_view fmt, Args &&... args) &&;
215217
/// Overload for @c WARN severity notes.
216-
template <typename... Args> self_type &warn(std::string_view fmt, Args &&... args);
218+
template <typename... Args> self_type &warn(std::string_view fmt, Args &&... args) &;
219+
template <typename... Args> self_type warn(std::string_view fmt, Args &&... args) &&;
217220
/// Overload for @c ERROR severity notes.
218-
template <typename... Args> self_type &error(std::string_view fmt, Args &&... args);
221+
template <typename... Args> self_type &error(std::string_view fmt, Args &&... args) &;
222+
template <typename... Args> self_type error(std::string_view fmt, Args &&... args) &&;
219223

220224
/// Remove all messages.
221225
/// @note This is also used to prevent logging.
@@ -694,28 +698,52 @@ Errata::note(Severity severity, std::string_view fmt, Args &&... args) {
694698

695699
template <typename... Args>
696700
Errata &
697-
Errata::diag(std::string_view fmt, Args &&... args) {
701+
Errata::diag(std::string_view fmt, Args &&... args) & {
698702
return this->note_v(Severity::DIAG, fmt, std::forward_as_tuple(args...));
699703
}
700704

705+
template <typename... Args>
706+
Errata
707+
Errata::diag(std::string_view fmt, Args &&... args) && {
708+
return std::move(this->note_v(Severity::DIAG, fmt, std::forward_as_tuple(args...)));
709+
}
710+
701711
template <typename... Args>
702712
Errata &
703-
Errata::info(std::string_view fmt, Args &&... args) {
713+
Errata::info(std::string_view fmt, Args &&... args) & {
704714
return this->note_v(Severity::INFO, fmt, std::forward_as_tuple(args...));
705715
}
706716

717+
template <typename... Args>
718+
Errata
719+
Errata::info(std::string_view fmt, Args &&... args) && {
720+
return std::move(this->note_v(Severity::INFO, fmt, std::forward_as_tuple(args...)));
721+
}
722+
707723
template <typename... Args>
708724
Errata &
709-
Errata::warn(std::string_view fmt, Args &&... args) {
725+
Errata::warn(std::string_view fmt, Args &&... args) & {
710726
return this->note_v(Severity::WARN, fmt, std::forward_as_tuple(args...));
711727
}
712728

729+
template <typename... Args>
730+
Errata
731+
Errata::warn(std::string_view fmt, Args &&... args) && {
732+
return std::move(this->note_v(Severity::WARN, fmt, std::forward_as_tuple(args...)));
733+
}
734+
713735
template <typename... Args>
714736
Errata &
715-
Errata::error(std::string_view fmt, Args &&... args) {
737+
Errata::error(std::string_view fmt, Args &&... args) & {
716738
return this->note_v(Severity::ERROR, fmt, std::forward_as_tuple(args...));
717739
}
718740

741+
template <typename... Args>
742+
Errata
743+
Errata::error(std::string_view fmt, Args &&... args) && {
744+
return std::move(this->note_v(Severity::ERROR, fmt, std::forward_as_tuple(args...)));
745+
}
746+
719747
inline Errata &
720748
Errata::note(self_type &&that) {
721749
this->note(that);

0 commit comments

Comments
 (0)