소스 검색

Move exceptions to their own file.

Sam Jaffe 5 년 전
부모
커밋
e8d31e88b2
4개의 변경된 파일19개의 추가작업 그리고 13개의 파일을 삭제
  1. 13 0
      include/pointers/exception.hpp
  2. 1 4
      include/pointers/maybe_null.hpp
  3. 1 0
      include/pointers/not_null.hpp
  4. 4 9
      include/pointers/pointer_fwd.hpp

+ 13 - 0
include/pointers/exception.hpp

@@ -0,0 +1,13 @@
+#pragma once
+
+#include <stdexcept>
+
+#include "pointer_fwd.hpp"
+
+class unchecked_pointer_exception : public std::logic_error {
+  using std::logic_error::logic_error;
+};
+
+class null_pointer_exception : public std::invalid_argument {
+  using std::invalid_argument::invalid_argument;
+};

+ 1 - 4
include/pointers/maybe_null.hpp

@@ -12,12 +12,9 @@
 
 #include "detail/compare.hpp"
 #include "detail/get_ptr.hpp"
+#include "exception.hpp"
 #include "pointer_fwd.hpp"
 
-class unchecked_pointer_exception : public std::logic_error {
-  using std::logic_error::logic_error;
-};
-
 template <typename P> class maybe_null<not_null<P>>; // not permitted
 
 #if defined(DEBUG)

+ 1 - 0
include/pointers/not_null.hpp

@@ -11,6 +11,7 @@
 #include <memory>
 
 #include "detail/compare.hpp"
+#include "exception.hpp"
 #include "maybe_null.hpp"
 #include "pointer_fwd.hpp"
 

+ 4 - 9
include/pointers/pointer_fwd.hpp

@@ -7,16 +7,11 @@
 
 #pragma once
 
-#include <stdexcept>
-
-template <typename> class not_null;
-template <typename> class maybe_null;
-template <typename> class owner;
 template <typename> class const_propogating_ptr;
 template <typename> class const_ptr;
+template <typename> class maybe_null;
+template <typename> class not_null;
+template <typename> class owner;
 
+class null_pointer_exception;
 class unchecked_pointer_exception;
-
-class null_pointer_exception : public std::invalid_argument {
-  using std::invalid_argument::invalid_argument;
-};