diff --git a/pointer.hpp b/pointer.hpp index bd55ccfc..0d39e035 100644 --- a/pointer.hpp +++ b/pointer.hpp @@ -17,6 +17,8 @@ #ifndef CRUFT_UTIL_POINTER_HPP #define CRUFT_UTIL_POINTER_HPP +#include "view.hpp" + #include #include @@ -37,6 +39,18 @@ namespace util { } + /////////////////////////////////////////////////////////////////////////// + template + constexpr util::view + align (util::view value, size_t alignment) + { + return { + align (value.begin (), alignment), + value.end () + }; + } + + ///------------------------------------------------------------------------ /// round the pointer upwards to satisfy the provided alignment constexpr inline uintptr_t