mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:17:35 +00:00
AK: Make Formatter for NonnullOwnPtr<T> format the T
This mirrors the behavior of NonnullRefPtr<T>. If you want to format the pointer address, call .ptr() on it.
This commit is contained in:
parent
f8e5df7a99
commit
b256e52586
2 changed files with 26 additions and 0 deletions
|
@ -196,7 +196,16 @@ inline void swap(NonnullOwnPtr<T>& a, NonnullOwnPtr<U>& b)
|
|||
a.swap(b);
|
||||
}
|
||||
|
||||
template<Formattable T>
|
||||
struct Formatter<NonnullOwnPtr<T>> : Formatter<T> {
|
||||
ErrorOr<void> format(FormatBuilder& builder, NonnullOwnPtr<T> const& value)
|
||||
{
|
||||
return Formatter<T>::format(builder, *value);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
requires(!HasFormatter<T>)
|
||||
struct Formatter<NonnullOwnPtr<T>> : Formatter<T const*> {
|
||||
ErrorOr<void> format(FormatBuilder& builder, NonnullOwnPtr<T> const& value)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue