diff options
author | Adam Midvidy <amidvidy@gmail.com> | 2015-03-24 15:58:03 -0400 |
---|---|---|
committer | Adam Midvidy <amidvidy@gmail.com> | 2015-03-24 15:58:04 -0400 |
commit | b17c75a2c0d94db497a7a37e81da7e2343c1da08 (patch) | |
tree | f0890529225da79949b3b6b13955f543bf5865c1 /src/mongo/base/status_with.h | |
parent | e23b1c0eba1aa58e22af068e8499c3b018693749 (diff) | |
download | mongo-b17c75a2c0d94db497a7a37e81da7e2343c1da08.tar.gz |
SERVER-17631 add makeStatusWith factory function
Diffstat (limited to 'src/mongo/base/status_with.h')
-rw-r--r-- | src/mongo/base/status_with.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/base/status_with.h b/src/mongo/base/status_with.h index 900dac70745..3cb8c2c7ca9 100644 --- a/src/mongo/base/status_with.h +++ b/src/mongo/base/status_with.h @@ -31,6 +31,7 @@ #include <iosfwd> #include <type_traits> +#include <utility> #include "mongo/base/status.h" @@ -124,6 +125,11 @@ namespace mongo { T _t; }; + template<typename T, typename... Args> + StatusWith<T> makeStatusWith(Args&&... args) { + return StatusWith<T>{T(std::forward<Args>(args)...)}; + } + template<typename T> std::ostream& operator<<(std::ostream& stream, const StatusWith<T>& sw) { if (sw.isOK()) |