aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/cru/common/base.hpp2
-rw-r--r--include/cru/common/event.hpp3
-rw-r--r--include/cru/common/self_resolvable.hpp3
-rw-r--r--include/cru/platform/check.hpp5
-rw-r--r--include/cru/ui/render/layout_render_object.hpp4
5 files changed, 7 insertions, 10 deletions
diff --git a/include/cru/common/base.hpp b/include/cru/common/base.hpp
index 4264142d..daee971f 100644
--- a/include/cru/common/base.hpp
+++ b/include/cru/common/base.hpp
@@ -1,6 +1,8 @@
#pragma once
#include "pre_config.hpp"
+#include <gsl/gsl>
+
#include <stdexcept>
#define CRU_UNUSED(entity) static_cast<void>(entity);
diff --git a/include/cru/common/event.hpp b/include/cru/common/event.hpp
index bc8670df..8389b38e 100644
--- a/include/cru/common/event.hpp
+++ b/include/cru/common/event.hpp
@@ -4,7 +4,6 @@
#include "self_resolvable.hpp"
#include <algorithm>
-#include <cassert>
#include <functional>
#include <memory>
#include <utility>
@@ -198,7 +197,7 @@ class EventRevokerGuard {
EventRevoker Get() {
// revoker is only null when this is moved
// you shouldn't use a moved instance
- assert(revoker_);
+ Expects(revoker_);
return *revoker_;
}
diff --git a/include/cru/common/self_resolvable.hpp b/include/cru/common/self_resolvable.hpp
index 708fea50..19c06a1b 100644
--- a/include/cru/common/self_resolvable.hpp
+++ b/include/cru/common/self_resolvable.hpp
@@ -1,7 +1,6 @@
#pragma once
#include "pre_config.hpp"
-#include <cassert>
#include <memory>
#include <type_traits>
@@ -26,7 +25,7 @@ class ObjectResolver {
T* Resolve() const {
// resolver_ is null only when this has been moved.
// You shouldn't resolve a moved resolver. So assert it.
- assert(resolver_);
+ Expects(resolver_);
return *resolver_;
}
diff --git a/include/cru/platform/check.hpp b/include/cru/platform/check.hpp
index 8e60e848..6128fe5a 100644
--- a/include/cru/platform/check.hpp
+++ b/include/cru/platform/check.hpp
@@ -3,7 +3,6 @@
#include "exception.hpp"
#include "resource.hpp"
-#include <cassert>
#include <memory>
#include <type_traits>
@@ -11,7 +10,7 @@ namespace cru::platform {
template <typename TTarget>
TTarget* CheckPlatform(INativeResource* resource,
const std::string_view& target_platform) {
- assert(resource);
+ Expects(resource);
const auto result = dynamic_cast<TTarget*>(resource);
if (result == nullptr) {
throw UnsupportPlatformException(util::Format(
@@ -28,7 +27,7 @@ std::shared_ptr<TTarget> CheckPlatform(
const std::string_view& target_platform) {
static_assert(std::is_base_of_v<INativeResource, TSource>,
"TSource must be a subclass of INativeResource.");
- assert(resource);
+ Expects(resource);
const auto result = std::dynamic_pointer_cast<TTarget>(resource);
if (result == nullptr) {
throw UnsupportPlatformException(util::Format(
diff --git a/include/cru/ui/render/layout_render_object.hpp b/include/cru/ui/render/layout_render_object.hpp
index 0b60a647..8700b8ba 100644
--- a/include/cru/ui/render/layout_render_object.hpp
+++ b/include/cru/ui/render/layout_render_object.hpp
@@ -3,8 +3,6 @@
#include "cru/platform/graph/util/painter.hpp"
-#include <cassert>
-
namespace cru::ui::render {
template <typename TChildLayoutData>
class LayoutRenderObject : public RenderObject {
@@ -21,7 +19,7 @@ class LayoutRenderObject : public RenderObject {
~LayoutRenderObject() override = default;
ChildLayoutData* GetChildLayoutData(int position) {
- assert(position >= 0 &&
+ Expects(position >= 0 &&
position < static_cast<int>(child_layout_data_.size()));
return &child_layout_data_[position];
}