ranges now accept container
parent
ea16aa3847
commit
f7ef78f351
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
include(cmake/color.cmake)
|
include(cmake/color.cmake)
|
||||||
set(BLT_VERSION 2.1.5)
|
set(BLT_VERSION 2.1.6)
|
||||||
|
|
||||||
set(BLT_TARGET BLT)
|
set(BLT_TARGET BLT)
|
||||||
|
|
||||||
|
|
|
@ -213,15 +213,18 @@ namespace blt
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<class R, class RCV = std::remove_cv_t<std::remove_reference_t<R>>, typename std::enable_if_t<
|
template<class R, class RCV = std::remove_cv_t<std::remove_reference_t<R>>, typename std::enable_if_t<
|
||||||
extent != dynamic_extent && span_detail::is_cont_v<RCV> &&
|
extent != dynamic_extent && span_detail::is_cont_v<RCV>, bool> = true>
|
||||||
std::is_convertible_v<std::remove_pointer_t<decltype(std::data(std::declval<R>()))>(*)[], T(*)[]>, bool> = true>
|
|
||||||
explicit constexpr span(R&& range): size_(std::size(range)), data_(std::data(range))
|
explicit constexpr span(R&& range): size_(std::size(range)), data_(std::data(range))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<class R, class RCV = std::remove_cv_t<std::remove_reference_t<R>>, typename std::enable_if_t<
|
template<class R, class RCV = std::remove_cv_t<std::remove_reference_t<R>>, typename std::enable_if_t<
|
||||||
extent == dynamic_extent && span_detail::is_cont_v<RCV> &&
|
extent == dynamic_extent && span_detail::is_cont_v<RCV>, bool> = true>
|
||||||
std::is_convertible_v<std::remove_pointer_t<decltype(std::data(std::declval<R>()))>(*)[], T(*)[]>, bool> = true>
|
constexpr span(R& range): size_(std::size(range)), data_(range.data()) // NOLINT
|
||||||
constexpr span(R&& range): size_(std::size(range)), data_(std::data(range)) // NOLINT
|
{}
|
||||||
|
|
||||||
|
template<class R, class RCV = std::remove_cv_t<std::remove_reference_t<R>>, typename std::enable_if_t<
|
||||||
|
extent == dynamic_extent && span_detail::is_cont_v<RCV>, bool> = true>
|
||||||
|
constexpr span(const R& range): size_(std::size(range)), data_(range.data()) // NOLINT
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<size_type SIZE, typename std::enable_if_t<
|
template<size_type SIZE, typename std::enable_if_t<
|
||||||
|
@ -358,6 +361,9 @@ namespace blt
|
||||||
template<class T, std::size_t N>
|
template<class T, std::size_t N>
|
||||||
span(T (&)[N]) -> span<T, N>;
|
span(T (&)[N]) -> span<T, N>;
|
||||||
|
|
||||||
|
template<class T, std::size_t N>
|
||||||
|
span(const T (&)[N]) -> span<T, N>;
|
||||||
|
|
||||||
template<class T, std::size_t N>
|
template<class T, std::size_t N>
|
||||||
span(std::array<T, N>&) -> span<T, N>;
|
span(std::array<T, N>&) -> span<T, N>;
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct abort_exception final : public std::exception
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if IS_GNU_BACKTRACE
|
#ifdef IS_GNU_BACKTRACE
|
||||||
#define BLT_STACK_TRACE(number) void* ptrs[number]; \
|
#define BLT_STACK_TRACE(number) void* ptrs[number]; \
|
||||||
int size = backtrace(ptrs, number); \
|
int size = backtrace(ptrs, number); \
|
||||||
char** messages = backtrace_symbols(ptrs, size);
|
char** messages = backtrace_symbols(ptrs, size);
|
||||||
|
@ -68,7 +68,7 @@ struct abort_exception final : public std::exception
|
||||||
namespace blt
|
namespace blt
|
||||||
{
|
{
|
||||||
|
|
||||||
#if IS_GNU_BACKTRACE
|
#ifdef IS_GNU_BACKTRACE
|
||||||
|
|
||||||
static inline std::string _macro_filename(const std::string& path)
|
static inline std::string _macro_filename(const std::string& path)
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ namespace blt
|
||||||
|
|
||||||
void b_throw(const char* what, const char* path, int line)
|
void b_throw(const char* what, const char* path, int line)
|
||||||
{
|
{
|
||||||
#if IS_GNU_BACKTRACE
|
#ifdef IS_GNU_BACKTRACE
|
||||||
BLT_STACK_TRACE(50);
|
BLT_STACK_TRACE(50);
|
||||||
|
|
||||||
BLT_ERROR("An exception '%s' has occurred in file '%s:%d'", what, path, line);
|
BLT_ERROR("An exception '%s' has occurred in file '%s:%d'", what, path, line);
|
||||||
|
@ -100,7 +100,7 @@ namespace blt
|
||||||
|
|
||||||
void b_assert_failed(const char* expression, const char* msg, const char* path, int line)
|
void b_assert_failed(const char* expression, const char* msg, const char* path, int line)
|
||||||
{
|
{
|
||||||
#if IS_GNU_BACKTRACE
|
#ifdef IS_GNU_BACKTRACE
|
||||||
BLT_STACK_TRACE(50);
|
BLT_STACK_TRACE(50);
|
||||||
|
|
||||||
BLT_ERROR("The assertion '%s' has failed in file '%s:%d'", expression, path, line);
|
BLT_ERROR("The assertion '%s' has failed in file '%s:%d'", expression, path, line);
|
||||||
|
@ -126,7 +126,7 @@ namespace blt
|
||||||
{
|
{
|
||||||
if (messages == nullptr)
|
if (messages == nullptr)
|
||||||
return;
|
return;
|
||||||
#if IS_GNU_BACKTRACE
|
#ifdef IS_GNU_BACKTRACE
|
||||||
for (int i = 1; i < size; i++)
|
for (int i = 1; i < size; i++)
|
||||||
{
|
{
|
||||||
int tabs = i - 1;
|
int tabs = i - 1;
|
||||||
|
@ -171,13 +171,13 @@ namespace blt
|
||||||
|
|
||||||
void b_abort(const char* what, const char* path, int line)
|
void b_abort(const char* what, const char* path, int line)
|
||||||
{
|
{
|
||||||
#if IS_GNU_BACKTRACE
|
#ifdef IS_GNU_BACKTRACE
|
||||||
BLT_STACK_TRACE(50);
|
BLT_STACK_TRACE(50);
|
||||||
#endif
|
#endif
|
||||||
BLT_FATAL("----{BLT ABORT}----");
|
BLT_FATAL("----{BLT ABORT}----");
|
||||||
BLT_FATAL("\tWhat: %s", what);
|
BLT_FATAL("\tWhat: %s", what);
|
||||||
BLT_FATAL("\tCalled from %s:%d", path, line);
|
BLT_FATAL("\tCalled from %s:%d", path, line);
|
||||||
#if IS_GNU_BACKTRACE
|
#ifdef IS_GNU_BACKTRACE
|
||||||
printStacktrace(messages, size, path, line);
|
printStacktrace(messages, size, path, line);
|
||||||
|
|
||||||
BLT_FREE_STACK_TRACE();
|
BLT_FREE_STACK_TRACE();
|
||||||
|
|
Loading…
Reference in New Issue