Skip to content

Commit

Permalink
style: constexpr functions are inline
Browse files Browse the repository at this point in the history
  • Loading branch information
vil02 committed Jan 27, 2024
1 parent 889405f commit 71befa7
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 49 deletions.
6 changes: 3 additions & 3 deletions api/any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ namespace jule
}

template <typename T>
inline constexpr jule::Bool operator!=(const T &expr) const
constexpr jule::Bool operator!=(const T &expr) const
{
return !this->operator==(expr);
}
Expand Down Expand Up @@ -279,12 +279,12 @@ namespace jule
return !this->operator==(other);
}

inline constexpr jule::Bool operator==(std::nullptr_t) const noexcept
constexpr jule::Bool operator==(std::nullptr_t) const noexcept
{
return !this->data;
}

inline constexpr jule::Bool operator!=(std::nullptr_t) const noexcept
constexpr jule::Bool operator!=(std::nullptr_t) const noexcept
{
return !this->operator==(nullptr);
}
Expand Down
16 changes: 8 additions & 8 deletions api/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,22 @@ namespace jule
typedef Item *Iterator;
typedef const Item *ConstIterator;

inline constexpr Iterator begin(void) noexcept
constexpr Iterator begin(void) noexcept
{
return this->buffer;
}

inline constexpr ConstIterator begin(void) const noexcept
constexpr ConstIterator begin(void) const noexcept
{
return this->buffer;
}

inline constexpr Iterator end(void) noexcept
constexpr Iterator end(void) noexcept
{
return this->begin() + N;
}

inline constexpr ConstIterator end(void) const noexcept
constexpr ConstIterator end(void) const noexcept
{
return this->begin() + N;
}
Expand Down Expand Up @@ -132,12 +132,12 @@ namespace jule
0, N);
}

inline constexpr jule::Int len(void) const noexcept
constexpr jule::Int len(void) const noexcept
{
return N;
}

inline constexpr jule::Bool empty(void) const noexcept
constexpr jule::Bool empty(void) const noexcept
{
return N == 0;
}
Expand All @@ -157,14 +157,14 @@ namespace jule
return true;
}

inline constexpr jule::Bool operator!=(const jule::Array<Item, N> &src) const
constexpr jule::Bool operator!=(const jule::Array<Item, N> &src) const
{
return !this->operator==(src);
}

// Returns element by index.
// Not includes safety checking.
inline constexpr Item &__at(const jule::Int &index) const noexcept
constexpr Item &__at(const jule::Int &index) const noexcept
{
return this->buffer[index];
}
Expand Down
10 changes: 5 additions & 5 deletions api/fn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ namespace jule
#endif
}

inline constexpr jule::Uintptr addr(void) const noexcept
constexpr jule::Uintptr addr(void) const noexcept
{
return this->_addr;
}
Expand All @@ -104,22 +104,22 @@ namespace jule
this->buffer = function;
}

inline constexpr jule::Bool operator==(const Fn<Function> &fn) const noexcept
constexpr jule::Bool operator==(const Fn<Function> &fn) const noexcept
{
return this->addr() == fn.addr();
}

inline constexpr jule::Bool operator!=(const Fn<Function> &fn) const noexcept
constexpr jule::Bool operator!=(const Fn<Function> &fn) const noexcept
{
return !this->operator==(fn);
}

inline constexpr jule::Bool operator==(std::nullptr_t) const noexcept
constexpr jule::Bool operator==(std::nullptr_t) const noexcept
{
return this->buffer == nullptr;
}

inline constexpr jule::Bool operator!=(std::nullptr_t) const noexcept
constexpr jule::Bool operator!=(std::nullptr_t) const noexcept
{
return !this->operator==(nullptr);
}
Expand Down
18 changes: 9 additions & 9 deletions api/map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,27 @@ namespace jule
this->buffer.insert(pair);
}

inline constexpr auto begin(void) noexcept
constexpr auto begin(void) noexcept
{
return this->buffer.begin();
}

inline constexpr auto begin(void) const noexcept
constexpr auto begin(void) const noexcept
{
return this->buffer.begin();
}

inline constexpr auto end(void) noexcept
constexpr auto end(void) noexcept
{
return this->buffer.end();
}

inline constexpr auto end(void) const noexcept
constexpr auto end(void) const noexcept
{
return this->buffer.end();
}

inline constexpr void clear(void) noexcept
constexpr void clear(void) noexcept
{
this->buffer.clear();
}
Expand All @@ -98,12 +98,12 @@ namespace jule
return keys;
}

inline constexpr jule::Bool has(const Key &key) const
constexpr jule::Bool has(const Key &key) const
{
return this->buffer.find(key) != this->end();
}

inline constexpr jule::Int len(void) const noexcept
constexpr jule::Int len(void) const noexcept
{
return this->buffer.size();
}
Expand All @@ -113,12 +113,12 @@ namespace jule
this->buffer.erase(key);
}

inline constexpr jule::Bool operator==(const std::nullptr_t) const noexcept
constexpr jule::Bool operator==(const std::nullptr_t) const noexcept
{
return this->buffer.empty();
}

inline constexpr jule::Bool operator!=(const std::nullptr_t) const noexcept
constexpr jule::Bool operator!=(const std::nullptr_t) const noexcept
{
return !this->operator==(nullptr);
}
Expand Down
4 changes: 2 additions & 2 deletions api/misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace jule
}

template <typename T, typename Denominator>
inline constexpr auto unsafe_div(
constexpr auto unsafe_div(
#ifndef __JULE_ENABLE__PRODUCTION
const char *file,
#endif
Expand All @@ -75,7 +75,7 @@ namespace jule
}

template <typename T, typename Denominator>
inline constexpr auto unsafe_mod(
constexpr auto unsafe_mod(
#ifndef __JULE_ENABLE__PRODUCTION
const char *file,
#endif
Expand Down
18 changes: 9 additions & 9 deletions api/slice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,22 +213,22 @@ namespace jule
typedef Item *Iterator;
typedef const Item *ConstIterator;

inline constexpr Iterator begin(void) noexcept
constexpr Iterator begin(void) noexcept
{
return this->_slice;
}

inline constexpr ConstIterator begin(void) const noexcept
constexpr ConstIterator begin(void) const noexcept
{
return this->_slice;
}

inline constexpr Iterator end(void) noexcept
constexpr Iterator end(void) noexcept
{
return this->_slice + this->_len;
}

inline constexpr ConstIterator end(void) const noexcept
constexpr ConstIterator end(void) const noexcept
{
return this->_slice + this->_len;
}
Expand Down Expand Up @@ -296,12 +296,12 @@ namespace jule
this->len());
}

inline constexpr jule::Int len(void) const noexcept
constexpr jule::Int len(void) const noexcept
{
return this->_len;
}

inline constexpr jule::Int cap(void) const noexcept
constexpr jule::Int cap(void) const noexcept
{
return this->_cap;
}
Expand Down Expand Up @@ -348,17 +348,17 @@ namespace jule
return true;
}

inline constexpr jule::Bool operator!=(const jule::Slice<Item> &src) const
constexpr jule::Bool operator!=(const jule::Slice<Item> &src) const
{
return !this->operator==(src);
}

inline constexpr jule::Bool operator==(const std::nullptr_t) const noexcept
constexpr jule::Bool operator==(const std::nullptr_t) const noexcept
{
return !this->_slice;
}

inline constexpr jule::Bool operator!=(const std::nullptr_t) const noexcept
constexpr jule::Bool operator!=(const std::nullptr_t) const noexcept
{
return !this->operator==(nullptr);
}
Expand Down
18 changes: 9 additions & 9 deletions api/str.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ namespace jule
typedef jule::U8 *Iterator;
typedef const jule::U8 *ConstIterator;

inline constexpr Iterator begin(void) noexcept
constexpr Iterator begin(void) noexcept
{
return static_cast<Iterator>(&this->buffer[0]);
}

inline constexpr ConstIterator begin(void) const noexcept
constexpr ConstIterator begin(void) const noexcept
{
return static_cast<ConstIterator>(&this->buffer[0]);
}

inline constexpr Iterator end(void) noexcept
constexpr Iterator end(void) noexcept
{
return static_cast<Iterator>(&this->buffer[this->len()]);
}

inline constexpr ConstIterator end(void) const noexcept
constexpr ConstIterator end(void) const noexcept
{
return static_cast<ConstIterator>(&this->buffer[this->len()]);
}
Expand Down Expand Up @@ -136,22 +136,22 @@ namespace jule
0, this->len());
}

inline constexpr jule::Int len(void) const noexcept
constexpr jule::Int len(void) const noexcept
{
return this->buffer.length();
}

inline constexpr jule::Bool empty(void) const noexcept
constexpr jule::Bool empty(void) const noexcept
{
return this->buffer.empty();
}

inline constexpr operator char *(void) const noexcept
constexpr operator char *(void) const noexcept
{
return const_cast<char *>(reinterpret_cast<const char *>(this->buffer.c_str()));
}

inline constexpr operator const char *(void) const noexcept
constexpr operator const char *(void) const noexcept
{
return reinterpret_cast<const char *>(this->buffer.c_str());
}
Expand Down Expand Up @@ -192,7 +192,7 @@ namespace jule

// Returns element by index.
// Not includes safety checking.
inline constexpr jule::U8 &__at(const jule::Int &index) noexcept
constexpr jule::U8 &__at(const jule::Int &index) noexcept
{
return this->buffer[index];
}
Expand Down
8 changes: 4 additions & 4 deletions api/trait.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,22 +238,22 @@ namespace jule
this->__get_copy(src);
}

inline constexpr jule::Bool operator==(const jule::Trait<Mask> &src) const noexcept
constexpr jule::Bool operator==(const jule::Trait<Mask> &src) const noexcept
{
return this->data.alloc == this->data.alloc;
}

inline constexpr jule::Bool operator!=(const jule::Trait<Mask> &src) const noexcept
constexpr jule::Bool operator!=(const jule::Trait<Mask> &src) const noexcept
{
return !this->operator==(src);
}

inline constexpr jule::Bool operator==(std::nullptr_t) const noexcept
constexpr jule::Bool operator==(std::nullptr_t) const noexcept
{
return this->data.alloc == nullptr;
}

inline constexpr jule::Bool operator!=(std::nullptr_t) const noexcept
constexpr jule::Bool operator!=(std::nullptr_t) const noexcept
{
return !this->operator==(nullptr);
}
Expand Down

0 comments on commit 71befa7

Please sign in to comment.