mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-26 00:21:13 +00:00
Add support for noexcept
This commit is contained in:
parent
3638eeee62
commit
5adb9f7a39
10
format.h
10
format.h
@ -41,6 +41,12 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
// Define FMT_USE_NOEXCEPT to make format use noexcept (C++11 feature).
|
||||||
|
#if FMT_USE_NOEXCEPT || \
|
||||||
|
(defined(__has_feature) && __has_feature(cxx_noexcept))
|
||||||
|
# define FMT_NOEXCEPT(expr) noexcept(expr)
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace fmt {
|
namespace fmt {
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
@ -957,7 +963,7 @@ class BasicFormatter : public BasicWriter<Char> {
|
|||||||
custom.format = &internal::FormatCustomArg<Char, T>;
|
custom.format = &internal::FormatCustomArg<Char, T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
~Arg() {
|
~Arg() FMT_NOEXCEPT(false) {
|
||||||
// Format is called here to make sure that a referred object is
|
// Format is called here to make sure that a referred object is
|
||||||
// still alive, for example:
|
// still alive, for example:
|
||||||
//
|
//
|
||||||
@ -1204,7 +1210,7 @@ class TempFormatter : public internal::ArgInserter<Char> {
|
|||||||
/**
|
/**
|
||||||
Performs the actual formatting, invokes the action and destroys the object.
|
Performs the actual formatting, invokes the action and destroys the object.
|
||||||
*/
|
*/
|
||||||
~TempFormatter() {
|
~TempFormatter() FMT_NOEXCEPT(false) {
|
||||||
if (this->formatter())
|
if (this->formatter())
|
||||||
action_(*this->Format());
|
action_(*this->Format());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user