- Documentation of containers, core, and format
This commit is contained in:
@@ -26,7 +26,7 @@ namespace fennec
|
||||
{
|
||||
|
||||
///
|
||||
/// \brief Struct for wrapping C++ `delete`
|
||||
/// \brief Struct for wrapping C++ \f$delete\f$
|
||||
/// \tparam TypeT The type of the buffer to be deleted
|
||||
template<typename TypeT>
|
||||
struct default_delete
|
||||
@@ -42,7 +42,7 @@ struct default_delete
|
||||
constexpr default_delete(const default_delete<ConvT>&) noexcept {}
|
||||
|
||||
///
|
||||
/// \brief Function Call Operator, calls `delete` on `ptr`
|
||||
/// \brief Function Call Operator, calls \f$delete\f$ on \f$ptr\f$
|
||||
/// \param ptr Memory resource to delete
|
||||
constexpr void operator()(TypeT* ptr) const noexcept {
|
||||
static_assert(not is_void_v<TypeT>, "cannot delete a pointer to an incomplete type");
|
||||
@@ -51,7 +51,8 @@ struct default_delete
|
||||
}
|
||||
};
|
||||
|
||||
// Overload for Arrays
|
||||
///
|
||||
/// \tparam TypeT The type of the buffer to be deleted
|
||||
template<typename TypeT>
|
||||
struct default_delete<TypeT[]>
|
||||
{
|
||||
@@ -66,7 +67,7 @@ struct default_delete<TypeT[]>
|
||||
constexpr default_delete(const default_delete<ConvT(*)[]>&) noexcept {}
|
||||
|
||||
///
|
||||
/// \brief Function Call Operator, calls `delete` on `ptr`
|
||||
/// \brief Function Call Operator, calls \f$delete\f$ on \f$ptr\f$
|
||||
/// \param ptr Memory resource to delete
|
||||
template<class ArrT> requires requires { is_convertible_v<ArrT(*)[], TypeT(*)[]> == true; }
|
||||
constexpr void operator()(TypeT* ptr) const noexcept {
|
||||
@@ -107,7 +108,7 @@ public:
|
||||
constexpr unique_ptr(nullptr_t) noexcept : unique_ptr(nullptr, delete_t()) {}
|
||||
|
||||
///
|
||||
/// \brief Pointer Constructor, creates a unique_ptr that owns `ptr` with deleter `del`
|
||||
/// \brief Pointer Constructor, creates a unique_ptr that owns \f$ptr\f$ with deleter \f$del\f$
|
||||
/// \param ptr The resource to own
|
||||
/// \param del The deleter
|
||||
explicit constexpr unique_ptr(pointer_t ptr, const delete_t& del = delete_t())
|
||||
@@ -116,7 +117,7 @@ public:
|
||||
}
|
||||
|
||||
///
|
||||
/// \brief Move Constructor, transfers ownership from `other`
|
||||
/// \brief Move Constructor, transfers ownership from \f$other\f$
|
||||
/// \param other The unique_ptr to take ownership from
|
||||
constexpr unique_ptr(unique_ptr&& other)
|
||||
: _handle(other._handle) {
|
||||
@@ -161,7 +162,7 @@ public:
|
||||
return retval;
|
||||
}
|
||||
|
||||
pointer_t get() {
|
||||
pointer_t get() const {
|
||||
return _handle;
|
||||
}
|
||||
|
||||
@@ -188,11 +189,11 @@ private:
|
||||
};
|
||||
|
||||
///
|
||||
/// \brief Creates a unique pointer holding an object of type `TypeT`
|
||||
/// \brief Creates a unique pointer holding an object of type \f$TypeT\f$
|
||||
/// \tparam TypeT The type
|
||||
/// \tparam ArgsT The constructor arguments, automatically deduced
|
||||
/// \param args The constructor arguments
|
||||
/// \returns A unique pointer holding a heap allocated object of type `TypeT` constructed with arguments `args`
|
||||
/// \returns A unique pointer holding a heap allocated object of type \f$TypeT\f$ constructed with arguments \f$args\f$
|
||||
template<typename TypeT, typename...ArgsT>
|
||||
unique_ptr<TypeT> make_unique(ArgsT&&...args) {
|
||||
return unique_ptr<TypeT>(new TypeT(fennec::forward<ArgsT>(args)...));
|
||||
|
||||
Reference in New Issue
Block a user