[ox/std] Add error.hpp include to memory.hpp
All checks were successful
Build / build (push) Successful in 2m15s
All checks were successful
Build / build (push) Successful in 2m15s
This commit is contained in:
parent
200e586768
commit
de9f842640
11
deps/ox/src/ox/std/memory.hpp
vendored
11
deps/ox/src/ox/std/memory.hpp
vendored
@ -39,6 +39,7 @@ constexpr T *construct_at(T *p, Args &&...args ) {
|
||||
|
||||
#endif
|
||||
|
||||
#include "error.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
|
||||
@ -290,4 +291,14 @@ constexpr auto make_unique(Args&&... args) {
|
||||
return UniquePtr<U>(new T(ox::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
template<typename T, typename U = T, typename ...Args>
|
||||
[[nodiscard]]
|
||||
constexpr Result<UniquePtr<U>> make_unique_catch(Args&&... args) noexcept {
|
||||
try {
|
||||
return UniquePtr<U>(new T(ox::forward<Args>(args)...));
|
||||
} catch (ox::Exception const&ex) {
|
||||
return ex.toError();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user