while profiling vector showed up as a marginal waster because it wasnt a
trivial class, a few if(m_someVector != Vector()) was causing a lot of
churn because of not being trivial and doing a lot of allocaitons and
destructions. make it trivial by defaulting constructor, and destructor,
and while we are at it make it constexpr friendly on constructors and
operators.
modernize validHierarchy and isConstructible, mark move operator
noexcept, use default destructor instead of {}, __deleter is a reserved
name, remove a underscore.
as per clangd docs.
The C standard additionally reserves names beginning with a double underscore,
while the C++ standard strengthens this to reserve names with a double underscore occurring anywhere.
for trivial types this is optimized away, non trivial it default
constructs and then assigns it upon construction, minor waste. so lets
use initializer list for these custom types.
* CRegion: introduce forEachRect
makes us able to directly call a function on each rect instead of using
getRects() allocating a vector every single time, especially when its
used in hot paths like the renderer.
* CRegion: cleanup CRegion of clangd warnings
overload pixman() with const, remove const_cast, mark move as noexcept.
ensure self assignment doesnt occur.
Without cstdint, building with GCC 16 fails with error
In file included from /tmp/hyprutils/tests/memory.cpp:1:
/tmp/hyprutils/./include/hyprutils/memory/UniquePtr.hpp: In member function ‘bool Hyprutils::Memory::CUniquePointer<T>::operator()(const Hyprutils:
:Memory::CUniquePointer<T>&, const Hyprutils::Memory::CUniquePointer<T>&) const’:
/tmp/hyprutils/./include/hyprutils/memory/UniquePtr.hpp:77:41: error: ‘uintptr_t’ does not name a type [-Wtemplate-body]
77 | return reinterpret_cast<uintptr_t>(lhs.impl_) < reinterpret_cast<uintptr_t>(rhs.impl_);
| ^~~~~~~~~
/tmp/hyprutils/./include/hyprutils/memory/UniquePtr.hpp:4:1: note: ‘uintptr_t’ is defined in header ‘<cstdint>’; this is probably fixable by adding
‘#include <cstdint>’
3 | #include "ImplBase.hpp"
+++ |+#include <cstdint>
4 |
/tmp/hyprutils/./include/hyprutils/memory/UniquePtr.hpp:77:82: error: ‘uintptr_t’ does not name a type [-Wtemplate-body]
77 | return reinterpret_cast<uintptr_t>(lhs.impl_) < reinterpret_cast<uintptr_t>(rhs.impl_);
| ^~~~~~~~~
/tmp/hyprutils/./include/hyprutils/memory/UniquePtr.hpp:77:82: note: ‘uintptr_t’ is defined in header ‘<cstdint>’; this is probably fixable by addi
ng ‘#include <cstdint>’
Downstream-bug: https://bugs.gentoo.org/957409
Signed-off-by: Brahmajit Das <listout@listout.xyz>
* signals: make CSignalT API compatible with CSignal
Also fixes emitting reference types
* signals: add a lot of tests
* animation: use CSignalT
* signals: automatically const-ref non arithmetic value types
* signals: allow listeners to ignore args
* signals: add forward()
Use nixbuild/nix-quick-install-action which pairs well with
nix-community/cache-nix-action.
Should help with build times by reducing the number of packages needing
to be re-downloaded on each run.
Parameters are taken from https://github.com/nix-community/cache-nix-action
and may be tweaked later.
Without the change the build on upcoming gcc-16 fails as:
[ 12%] Building CXX object CMakeFiles/hyprutils.dir/src/signal/Listener.cpp.o
In file included from /build/source/./include/hyprutils/signal/Listener.hpp:5,
from /build/source/src/signal/Listener.cpp:1:
/build/source/./include/hyprutils/memory/SharedPtr.hpp: In member function 'bool Hyprutils::Memory::CSharedPointer<T>::operator()(const Hyprutils::Memory::CSharedPointer<T>&, const Hyprutils::Memory::CSharedPointer<T>&) const':
/build/source/./include/hyprutils/memory/SharedPtr.hpp:116:41: error: 'uintptr_t' does not name a type [-Wtemplate-body]
116 | return reinterpret_cast<uintptr_t>(lhs.impl_) < reinterpret_cast<uintptr_t>(rhs.impl_);
| ^~~~~~~~~
* memory: Add force reinterpret constructor to shared pointer
* memory: Change constructor to reinterpretPointerCast function
* memory: Add reinterpretPointerCast test