mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-03 16:30:29 +00:00
Remove some unnecessary includes
This commit is contained in:
parent
206bdb76b2
commit
f138d80c29
1 changed files with 16 additions and 5 deletions
|
@ -3,14 +3,14 @@
|
||||||
#ifndef CTL_SHARED_PTR_H_
|
#ifndef CTL_SHARED_PTR_H_
|
||||||
#define CTL_SHARED_PTR_H_
|
#define CTL_SHARED_PTR_H_
|
||||||
|
|
||||||
#include "conditional.h"
|
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
#include "is_convertible.h"
|
#include "is_convertible.h"
|
||||||
#include "is_void.h"
|
|
||||||
#include "new.h"
|
|
||||||
#include "remove_extent.h"
|
#include "remove_extent.h"
|
||||||
#include "unique_ptr.h"
|
#include "unique_ptr.h"
|
||||||
|
|
||||||
|
// XXX currently needed to use placement-new syntax (move to cxx.inc?)
|
||||||
|
void* operator new(size_t, void*) noexcept;
|
||||||
|
|
||||||
namespace ctl {
|
namespace ctl {
|
||||||
|
|
||||||
class bad_weak_ptr : public exception
|
class bad_weak_ptr : public exception
|
||||||
|
@ -24,6 +24,18 @@ class bad_weak_ptr : public exception
|
||||||
|
|
||||||
namespace __ {
|
namespace __ {
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct ptr_ref
|
||||||
|
{
|
||||||
|
using type = T&;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct ptr_ref<void>
|
||||||
|
{
|
||||||
|
using type = void;
|
||||||
|
};
|
||||||
|
|
||||||
static inline __attribute__((always_inline)) void
|
static inline __attribute__((always_inline)) void
|
||||||
incref(size_t* r) noexcept
|
incref(size_t* r) noexcept
|
||||||
{
|
{
|
||||||
|
@ -302,8 +314,7 @@ class shared_ptr
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
conditional_t<is_void_v<T>, void, add_lvalue_reference_t<T>> operator*()
|
typename __::ptr_ref<T>::type operator*() const noexcept
|
||||||
const noexcept
|
|
||||||
{
|
{
|
||||||
if (!p)
|
if (!p)
|
||||||
__builtin_trap();
|
__builtin_trap();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue