mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-05 09:20:29 +00:00
clang-format
This commit is contained in:
parent
79c0e97dcf
commit
df00ae1bca
2 changed files with 21 additions and 16 deletions
|
@ -76,12 +76,14 @@ struct shared_pointer : shared_control
|
|||
template<typename T>
|
||||
struct shared_emplace : shared_control
|
||||
{
|
||||
union {
|
||||
union
|
||||
{
|
||||
T t;
|
||||
};
|
||||
|
||||
template<typename... Args>
|
||||
void construct(Args&&... args) {
|
||||
void construct(Args&&... args)
|
||||
{
|
||||
::new (&t) T(ctl::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
|
@ -123,12 +125,12 @@ class shared_ptr
|
|||
public:
|
||||
using element_type = T; // TODO(mrdomino): remove extent?
|
||||
|
||||
constexpr shared_ptr(nullptr_t = nullptr) noexcept
|
||||
: p(nullptr), rc(nullptr)
|
||||
constexpr shared_ptr(nullptr_t = nullptr) noexcept : p(nullptr), rc(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
explicit shared_ptr(auto* const p) : p(p), rc(__::shared_pointer<T>::make(p))
|
||||
explicit shared_ptr(auto* const p)
|
||||
: p(p), rc(__::shared_pointer<T>::make(p))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -250,7 +252,8 @@ class shared_ptr
|
|||
};
|
||||
|
||||
template<typename T, typename... Args>
|
||||
shared_ptr<T> make_shared(Args&&... args)
|
||||
shared_ptr<T>
|
||||
make_shared(Args&&... args)
|
||||
{
|
||||
auto rc = __::shared_emplace<T>::make_unique();
|
||||
rc->construct(ctl::forward<Args>(args)...);
|
||||
|
|
|
@ -27,7 +27,9 @@ template<typename T>
|
|||
using Ptr = ctl::shared_ptr<T>;
|
||||
|
||||
template<typename T, typename... Args>
|
||||
Ptr<T> Mk(Args&&... args) {
|
||||
Ptr<T>
|
||||
Mk(Args&&... args)
|
||||
{
|
||||
return ctl::make_shared<T>(ctl::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue