Added nodiscard

This commit is contained in:
Istvan Haller
2021-08-06 15:08:24 +01:00
parent 22e2b5b689
commit df62abac55

View File

@@ -188,7 +188,7 @@ namespace snmalloc
/** /**
* Get the number of entries. * Get the number of entries.
*/ */
constexpr size_t num_entries() const [[nodiscard]] constexpr size_t num_entries() const
{ {
if constexpr (has_bounds) if constexpr (has_bounds)
{ {
@@ -242,7 +242,7 @@ namespace snmalloc
* Return the starting address corresponding to a given entry within the * Return the starting address corresponding to a given entry within the
* Pagemap. Also checks that the reference actually points to a valid entry. * Pagemap. Also checks that the reference actually points to a valid entry.
*/ */
address_t get_address(const T& t) const [[nodiscard]] address_t get_address(const T& t) const
{ {
address_t entry_offset = address_cast(&t) - address_cast(body); address_t entry_offset = address_cast(&t) - address_cast(body);
address_t entry_index = entry_offset / sizeof(T); address_t entry_index = entry_offset / sizeof(T);