diff options
Diffstat (limited to 'extern/ceres/internal/ceres/casts.h')
-rw-r--r-- | extern/ceres/internal/ceres/casts.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/extern/ceres/internal/ceres/casts.h b/extern/ceres/internal/ceres/casts.h index d13707131c2..04d8ba4fe33 100644 --- a/extern/ceres/internal/ceres/casts.h +++ b/extern/ceres/internal/ceres/casts.h @@ -32,14 +32,13 @@ #define CERES_INTERNAL_CASTS_H_ #include <cassert> -#include <cstddef> // For NULL. namespace ceres { // Identity metafunction. template <class T> struct identity_ { - typedef T type; + using type = T; }; // Use implicit_cast as a safe version of static_cast or const_cast @@ -86,6 +85,7 @@ inline To implicit_cast(typename identity_<From>::type const& f) { // if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo); // You should design the code some other way not to need this. +// TODO(sameeragarwal): Modernize this. template <typename To, typename From> // use like this: down_cast<T*>(foo); inline To down_cast(From* f) { // so we only accept pointers // Ensures that To is a sub-type of From *. This test is here only @@ -95,11 +95,11 @@ inline To down_cast(From* f) { // so we only accept pointers // TODO(csilvers): This should use COMPILE_ASSERT. if (false) { - implicit_cast<From*, To>(NULL); + implicit_cast<From*, To>(nullptr); } // uses RTTI in dbg and fastbuild. asserts are disabled in opt builds. - assert(f == NULL || dynamic_cast<To>(f) != NULL); // NOLINT + assert(f == nullptr || dynamic_cast<To>(f) != nullptr); // NOLINT return static_cast<To>(f); } |