79template<
typename T,
typename Deleter = default_delete<T>>
112 bool object_constructed;
122 constexpr fl::size_t align = control_block_alignment<T>::value;
125 static void operator delete(
void* ptr) {
139 if (object_constructed) {
141 object_constructed =
false;
205 template<typename Y, typename = typename fl::enable_if<fl::is_base_of<T, Y>::value>
::type>
212 other.mPtr =
nullptr;
213 other.mControlBlock =
nullptr;
217 template<typename Y, typename = typename fl::enable_if<fl::is_base_of<T, Y>::value>
::type>
219 other.mPtr =
nullptr;
220 other.mControlBlock =
nullptr;
245 if (
this != &other) {
255 template<typename Y, typename = typename fl::enable_if<fl::is_base_of<T, Y>::value>
::type>
258 mPtr =
static_cast<T*
>(other.mPtr);
265 if (
this != &other) {
273 template<typename Y, typename = typename fl::enable_if<fl::is_base_of<T, Y>::value>
::type>
275 if (
static_cast<void*
>(
this) !=
static_cast<void*
>(&other)) {
277 mPtr =
static_cast<T*
>(other.mPtr);
279 other.mPtr =
nullptr;
280 other.mControlBlock =
nullptr;
362 return mPtr ==
nullptr;
366 return mPtr !=
nullptr;
382 template<
typename Y,
typename Deleter>
394 template<
typename Y,
typename... Args>
397 template<
typename Y,
typename Deleter,
typename... Args>
400 template<
typename Y,
typename A,
typename... Args>
413template<
typename T,
typename... Args>
426 void* mem = detail::InlinedControlBlock<T>::operator
new(
427 sizeof(detail::InlinedControlBlock<T>));
428 if (mem ==
nullptr) {
431 auto* control = ::new (mem) detail::InlinedControlBlock<T>();
432 T* obj = control->get_object();
434 control->object_constructed =
true;
438template<
typename T,
typename Deleter,
typename... Args>
441 if (obj ==
nullptr) {
445 if (control ==
nullptr) {
466 if (arr ==
nullptr) {
470 if (control ==
nullptr) {
478template<
typename T,
typename A,
typename... Args>
486template<
typename T,
typename Y>
488 return lhs.get() == rhs.get();
491template<
typename T,
typename Y>
493 return lhs.get() != rhs.get();
496template<
typename T,
typename Y>
498 return lhs.get() < rhs.get();
501template<
typename T,
typename Y>
503 return lhs.get() <= rhs.get();
506template<
typename T,
typename Y>
508 return lhs.get() > rhs.get();
511template<
typename T,
typename Y>
513 return lhs.get() >= rhs.get();
518 return lhs.get() ==
nullptr;
523 return nullptr == rhs.get();
528 return lhs.get() !=
nullptr;
533 return nullptr != rhs.get();
543template<
typename T,
typename Y>
548template<
typename T,
typename Y>
553template<
typename T,
typename Y>
565#define FASTLED_SHARED_PTR(type) \
567 using type##Ptr = fl::shared_ptr<type>;
570#define FASTLED_SHARED_PTR_STRUCT(type) \
572 using type##Ptr = fl::shared_ptr<type>;
576#define FASTLED_SHARED_PTR_NO_FWD(type) using type##Ptr = fl::shared_ptr<type>;
579#define FASTLED_SMART_PTR(type) FASTLED_SHARED_PTR(type)
580#define FASTLED_SMART_PTR_STRUCT(type) FASTLED_SHARED_PTR_STRUCT(type)
581#define FASTLED_SMART_PTR_NO_FWD(type) FASTLED_SHARED_PTR_NO_FWD(type)
Alignment macros and utilities for FastLED.
void reset(shared_ptr &&other) FL_NO_EXCEPT
bool operator!=(fl::nullptr_t) const FL_NO_EXCEPT
detail::ControlBlockBase * mControlBlock
shared_ptr() FL_NO_EXCEPT
void reset() FL_NO_EXCEPT
shared_ptr(Y *ptr, Deleter d) FL_NO_EXCEPT
void swap(shared_ptr &other) FL_NO_EXCEPT
void swap(shared_ptr &&other) FL_NO_EXCEPT
weak_ptr< filebuf > weak_type
T * get() const FL_NO_EXCEPT
friend shared_ptr< Y > make_shared_array(size_t n) FL_NO_EXCEPT
shared_ptr(Y *ptr) FL_NO_EXCEPT
long use_count() const FL_NO_EXCEPT
T * operator->() const FL_NO_EXCEPT
bool unique() const FL_NO_EXCEPT
bool operator==(fl::nullptr_t) const FL_NO_EXCEPT
friend shared_ptr< Y > allocate_shared(const A &alloc, Args &&... args) FL_NO_EXCEPT
friend shared_ptr< Y > make_shared_with_deleter(Deleter d, Args &&... args) FL_NO_EXCEPT
shared_ptr(T *ptr, detail::ControlBlockBase *control_block, detail::no_tracking_tag) FL_NO_EXCEPT
friend shared_ptr< Y > make_shared(Args &&... args) FL_NO_EXCEPT
shared_ptr(const weak_ptr< Y > &weak) FL_NO_EXCEPT
shared_ptr(shared_ptr &&other) FL_NO_EXCEPT
T & operator[](ptrdiff_t idx) const FL_NO_EXCEPT
shared_ptr(const shared_ptr< Y > &other, T *ptr) FL_NO_EXCEPT
shared_ptr(shared_ptr< Y > &&other) FL_NO_EXCEPT
shared_ptr(T *ptr, detail::ControlBlockBase *control_block, detail::make_shared_tag) FL_NO_EXCEPT
shared_ptr(fl::nullptr_t) FL_NO_EXCEPT
~shared_ptr() FL_DTOR_NOEXCEPT
bool is_no_tracking() const FL_NO_EXCEPT
shared_ptr & operator=(shared_ptr< Y > &&other) FL_NO_EXCEPT
shared_ptr & operator=(shared_ptr &&other) FL_NO_EXCEPT
shared_ptr & operator=(const shared_ptr &other) FL_NO_EXCEPT
shared_ptr(const shared_ptr &other) FL_NO_EXCEPT
void acquire() FL_NO_EXCEPT
shared_ptr & operator=(const shared_ptr< Y > &other) FL_NO_EXCEPT
shared_ptr(const shared_ptr< Y > &other) FL_NO_EXCEPT
friend shared_ptr< Y > make_shared_no_tracking(Y &obj) FL_NO_EXCEPT
T & operator*() const FL_NO_EXCEPT
Compile-time linker keep-alive hook for a single fl::Bus.
decltype(nullptr) nullptr_t
void swap(array< T, N > &lhs, array< T, N > &rhs) FL_NO_EXCEPT
constexpr int type_rank< T >::value
shared_ptr< T > const_pointer_cast(const shared_ptr< Y > &other) FL_NO_EXCEPT
void aligned_free(void *ptr)
FASTLED_FORCE_INLINE bool operator==(const CRGB &lhs, const CRGB &rhs) FL_NO_EXCEPT
Check if two CRGB objects have the same color data.
void * aligned_alloc(fl::size_t alignment, fl::size_t size)
atomic< fl::u32 > atomic_u32
FASTLED_FORCE_INLINE bool operator>(const CRGB &lhs, const CRGB &rhs) FL_NO_EXCEPT
Check if the sum of the color channels in one CRGB object is greater than another.
shared_ptr< T > make_shared_array(size_t n) FL_NO_EXCEPT
shared_ptr< T > make_shared(Args &&... args) FL_NO_EXCEPT
FASTLED_FORCE_INLINE bool operator<=(const CRGB &lhs, const CRGB &rhs) FL_NO_EXCEPT
Check if the sum of the color channels in one CRGB object is less than or equal to another.
struct FL_ALIGNAS(4) Wave3BitExpansionLut
Lookup table for nibble-to-waveform expansion in wave3 format (32 bytes)
constexpr T && forward(typename remove_reference< T >::type &t) FL_NO_EXCEPT
shared_ptr< T > allocate_shared(const A &, Args &&... args) FL_NO_EXCEPT
InputGamut g FL_NO_EXCEPT
To bit_cast(const From &from) FL_NO_EXCEPT
shared_ptr< T > make_shared_no_tracking(T &obj) FL_NO_EXCEPT
shared_ptr< T > static_pointer_cast(const shared_ptr< Y > &other) FL_NO_EXCEPT
FASTLED_FORCE_INLINE bool operator!=(const CRGB &lhs, const CRGB &rhs) FL_NO_EXCEPT
Check if two CRGB objects do not have the same color data.
shared_ptr< T > reinterpret_pointer_cast(const shared_ptr< Y > &other) FL_NO_EXCEPT
FASTLED_FORCE_INLINE bool operator>=(const CRGB &lhs, const CRGB &rhs) FL_NO_EXCEPT
Check if the sum of the color channels in one CRGB object is greater than or equal to another.
shared_ptr< T > make_shared_with_deleter(Deleter d, Args &&... args) FL_NO_EXCEPT
FASTLED_FORCE_INLINE bool operator<(const CRGB &lhs, const CRGB &rhs) FL_NO_EXCEPT
Check if the sum of the color channels in one CRGB object is less than another.
Base definition for an LED controller.
void destroy_object() FL_NO_EXCEPT override
void destroy_control_block() FL_NO_EXCEPT override
ControlBlock(T *p, Deleter d=Deleter(), bool track=true) FL_NO_EXCEPT
static constexpr fl::u32 NO_TRACKING_VALUE
virtual void destroy_control_block() FL_NO_EXCEPT=0
fl::atomic_u32 shared_count
void add_shared_ref() FL_NO_EXCEPT
virtual void destroy_object() FL_NO_EXCEPT=0
ControlBlockBase(bool track=true) FL_NO_EXCEPT
bool is_no_tracking() const FL_NO_EXCEPT
bool remove_shared_ref() FL_NO_EXCEPT
virtual ~ControlBlockBase() FL_DTOR_NOEXCEPT
fl::atomic_u32 weak_count
void operator()(T *ptr) const FL_NO_EXCEPT
static constexpr fl::size value
void operator()(T *ptr) const FL_NO_EXCEPT
void operator()(T *) const FL_NO_EXCEPT