Added more stuff like Logging, DynamicPointer, utilities for using STL allocators and NotNullable.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#define MIJIN_UTIL_CONCEPTS_HPP_INCLUDED 1
|
||||
|
||||
#include <type_traits>
|
||||
#include "./traits.hpp"
|
||||
|
||||
namespace mijin
|
||||
{
|
||||
@@ -39,6 +40,32 @@ concept pointer_type = std::is_pointer_v<T>;
|
||||
template<typename T>
|
||||
concept reference_type = std::is_reference_v<T>;
|
||||
|
||||
namespace impl
|
||||
{
|
||||
template<typename T>
|
||||
using pointer_t = typename T::pointer;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
concept allocator_type = requires(T alloc, typename T::value_type value, detect_or_t<typename T::value_type*, impl::pointer_t, T> pointer, int count)
|
||||
{
|
||||
typename T::value_type;
|
||||
{ alloc.allocate(count) } -> std::same_as<decltype(pointer)>;
|
||||
{ alloc.deallocate(pointer, count) } -> std::same_as<void>;
|
||||
} && !std::is_const_v<typename T::value_type> && !std::is_volatile_v<typename T::value_type>;
|
||||
|
||||
template<typename T, typename TOther>
|
||||
concept allocator_type_for = allocator_type<T> && std::is_same_v<typename T::value_type, TOther>;
|
||||
|
||||
template<template<typename> typename T>
|
||||
concept allocator_tmpl = allocator_type<T<int>>;
|
||||
|
||||
template<typename T, typename TData>
|
||||
concept deleter_type = requires(T deleter, TData* ptr)
|
||||
{
|
||||
deleter(ptr);
|
||||
};
|
||||
|
||||
//
|
||||
// public functions
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user