Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
trcrsired committed Dec 3, 2024
2 parents ba3a3e7 + 7955b94 commit 8cfb14f
Showing 1 changed file with 70 additions and 2 deletions.
72 changes: 70 additions & 2 deletions include/fast_io_core_impl/freestanding/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,20 @@ struct array
using size_type = ::std::size_t;
using difference_type = ::std::ptrdiff_t;
T element[N];
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#elif __has_cpp_attribute(msvc::forceinline)
[[msvc::forceinline]]
#endif
inline constexpr T *data() noexcept
{
return element;
}
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#elif __has_cpp_attribute(msvc::forceinline)
[[msvc::forceinline]]
#endif
inline constexpr T const *data() const noexcept
{
return element;
Expand Down Expand Up @@ -55,56 +65,114 @@ struct array
{
return element + N;
}
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#elif __has_cpp_attribute(msvc::forceinline)
[[msvc::forceinline]]
#endif
inline constexpr T const &front() const noexcept
{
return *element;
}
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#elif __has_cpp_attribute(msvc::forceinline)
[[msvc::forceinline]]
#endif
inline constexpr T &front() noexcept
{
return *element;
}
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#elif __has_cpp_attribute(msvc::forceinline)
[[msvc::forceinline]]
#endif
inline constexpr T const &back() const noexcept
{
constexpr size_type nm1{N - 1};
return element[nm1];
}
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#elif __has_cpp_attribute(msvc::forceinline)
[[msvc::forceinline]]
#endif
inline constexpr T &back() noexcept
{
constexpr size_type nm1{N - 1};
return element[nm1];
}

#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#elif __has_cpp_attribute(msvc::forceinline)
[[msvc::forceinline]]
#endif
inline constexpr T const &front_unchecked() const noexcept
{
return *element;
}
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#elif __has_cpp_attribute(msvc::forceinline)
[[msvc::forceinline]]
#endif
inline constexpr T &front_unchecked() noexcept
{
return *element;
}
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#elif __has_cpp_attribute(msvc::forceinline)
[[msvc::forceinline]]
#endif
inline constexpr T const &back_unchecked() const noexcept
{
constexpr size_type nm1{N - 1};
return element[nm1];
}
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#elif __has_cpp_attribute(msvc::forceinline)
[[msvc::forceinline]]
#endif
inline constexpr T &back_unchecked() noexcept
{
constexpr size_type nm1{N - 1};
return element[nm1];
}

#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#elif __has_cpp_attribute(msvc::forceinline)
[[msvc::forceinline]]
#endif
inline constexpr T const &operator[](::std::size_t i) const noexcept
{
return element[i];
}
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#elif __has_cpp_attribute(msvc::forceinline)
[[msvc::forceinline]]
#endif
inline constexpr T &operator[](::std::size_t i) noexcept
{
return element[i];
}
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#elif __has_cpp_attribute(msvc::forceinline)
[[msvc::forceinline]]
#endif
inline constexpr T const &index_unchecked(::std::size_t i) const noexcept
{
return element[i];
}
#if __has_cpp_attribute(__gnu__::__always_inline__)
[[__gnu__::__always_inline__]]
#elif __has_cpp_attribute(msvc::forceinline)
[[msvc::forceinline]]
#endif
inline constexpr T &index_unchecked(::std::size_t i) noexcept
{
return element[i];
Expand Down

0 comments on commit 8cfb14f

Please sign in to comment.