summaryrefslogtreecommitdiff
path: root/src/mongo/base/checked_cast.h
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 00:22:50 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 10:56:02 -0400
commit9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 (patch)
tree3814f79c10d7b490948d8cb7b112ac1dd41ceff1 /src/mongo/base/checked_cast.h
parent01965cf52bce6976637ecb8f4a622aeb05ab256a (diff)
downloadmongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/base/checked_cast.h')
-rw-r--r--src/mongo/base/checked_cast.h67
1 files changed, 33 insertions, 34 deletions
diff --git a/src/mongo/base/checked_cast.h b/src/mongo/base/checked_cast.h
index c4e9fe2ffc1..94cf5ea9c1f 100644
--- a/src/mongo/base/checked_cast.h
+++ b/src/mongo/base/checked_cast.h
@@ -35,43 +35,42 @@
namespace mongo {
- /**
- * Similar to static_cast, but in debug builds uses RTTI to confirm that the cast
- * is legal at runtime.
- */
- template<bool>
- struct checked_cast_impl;
-
- template<>
- struct checked_cast_impl<false> {
- template<typename T, typename U>
- static T cast(const U& u) {
- return static_cast<T>(u);
- }
- };
+/**
+ * Similar to static_cast, but in debug builds uses RTTI to confirm that the cast
+ * is legal at runtime.
+ */
+template <bool>
+struct checked_cast_impl;
- template<>
- struct checked_cast_impl<true> {
- template<typename T, typename U>
- static T cast(U* u) {
- if (!u) {
- return NULL;
- }
- T t = dynamic_cast<T>(u);
- invariant(t);
- return t;
- }
+template <>
+struct checked_cast_impl<false> {
+ template <typename T, typename U>
+ static T cast(const U& u) {
+ return static_cast<T>(u);
+ }
+};
- template<typename T, typename U>
- static T cast(const U& u) {
- return dynamic_cast<T>(u);
+template <>
+struct checked_cast_impl<true> {
+ template <typename T, typename U>
+ static T cast(U* u) {
+ if (!u) {
+ return NULL;
}
+ T t = dynamic_cast<T>(u);
+ invariant(t);
+ return t;
+ }
- };
+ template <typename T, typename U>
+ static T cast(const U& u) {
+ return dynamic_cast<T>(u);
+ }
+};
- template<typename T, typename U>
- T checked_cast(const U& u) {
- return checked_cast_impl<kDebugBuild>::cast<T>(u);
- };
+template <typename T, typename U>
+T checked_cast(const U& u) {
+ return checked_cast_impl<kDebugBuild>::cast<T>(u);
+};
-} // namespace mongo
+} // namespace mongo