Skip to content

Commit

Permalink
fixed is_table<>
Browse files Browse the repository at this point in the history
  • Loading branch information
marzer committed Aug 5, 2023
1 parent e06f331 commit fd78e5d
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 33 deletions.
3 changes: 0 additions & 3 deletions src/soagen/hpp/allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

#include "generated/functions.hpp"
#include "header_start.hpp"
#if SOAGEN_CLANG >= 16
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif

namespace soagen
{
Expand Down
3 changes: 0 additions & 3 deletions src/soagen/hpp/column_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

#include "generated/functions.hpp"
#include "header_start.hpp"
#if SOAGEN_CLANG >= 16
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif

#define soagen_storage_ptr(...) soagen::assume_aligned<alignof(storage_type)>(__VA_ARGS__)

Expand Down
3 changes: 3 additions & 0 deletions src/soagen/hpp/header_start.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
//# push the current warning state
SOAGEN_PUSH_WARNINGS;
SOAGEN_DISABLE_SPAM_WARNINGS;
#if SOAGEN_CLANG >= 16
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif

//# disable windows.h min/max macro crimes
#if SOAGEN_MSVC_LIKE
Expand Down
26 changes: 8 additions & 18 deletions src/soagen/hpp/single/soagen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,9 @@ SOAGEN_ENABLE_WARNINGS;

SOAGEN_PUSH_WARNINGS;
SOAGEN_DISABLE_SPAM_WARNINGS;
#if SOAGEN_CLANG >= 16
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif

#if SOAGEN_MSVC_LIKE
#pragma push_macro("min")
Expand Down Expand Up @@ -2167,6 +2170,9 @@ SOAGEN_POP_WARNINGS;

SOAGEN_PUSH_WARNINGS;
SOAGEN_DISABLE_SPAM_WARNINGS;
#if SOAGEN_CLANG >= 16
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif

#if SOAGEN_MSVC_LIKE
#pragma push_macro("min")
Expand Down Expand Up @@ -2428,10 +2434,6 @@ namespace soagen

//******** allocator.hpp *********************************************************************************************

#if SOAGEN_CLANG >= 16
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif

namespace soagen
{
struct allocator
Expand Down Expand Up @@ -2660,10 +2662,6 @@ namespace soagen

//******** column_traits.hpp *****************************************************************************************

#if SOAGEN_CLANG >= 16
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif

#define soagen_storage_ptr(...) soagen::assume_aligned<alignof(storage_type)>(__VA_ARGS__)

namespace soagen::detail
Expand Down Expand Up @@ -3501,10 +3499,6 @@ namespace soagen::detail

//******** table_traits.hpp ******************************************************************************************

#if SOAGEN_CLANG >= 16
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif

namespace soagen::detail
{
// a base class for the table traits that handles all the non-alignment-dependent stuff -
Expand Down Expand Up @@ -4441,10 +4435,6 @@ namespace soagen::detail

//******** table.hpp *************************************************************************************************

#if SOAGEN_CLANG >= 16
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif

namespace soagen::detail
{
SOAGEN_CONSTRAINED_TEMPLATE(is_unsigned<T>, typename T)
Expand Down Expand Up @@ -5944,8 +5934,8 @@ namespace soagen
template <typename>
inline constexpr bool is_table = POXY_IMPLEMENTATION_DETAIL(false);

template <typename... Args>
inline constexpr bool is_table<table<Args...>> = true;
template <typename Traits, typename Allocator, template <typename> typename Base>
inline constexpr bool is_table<table<Traits, Allocator, Base>> = true;
template <typename T>
inline constexpr bool is_table<const T> = is_table<T>;
template <typename T>
Expand Down
8 changes: 2 additions & 6 deletions src/soagen/hpp/table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
#include "table_traits.hpp"
#include "header_start.hpp"

#if SOAGEN_CLANG >= 16
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif

/// @cond
namespace soagen::detail
{
Expand Down Expand Up @@ -1678,8 +1674,8 @@ namespace soagen
template <typename>
inline constexpr bool is_table = POXY_IMPLEMENTATION_DETAIL(false);
/// @cond
template <typename... Args>
inline constexpr bool is_table<table<Args...>> = true;
template <typename Traits, typename Allocator, template <typename> typename Base>
inline constexpr bool is_table<table<Traits, Allocator, Base>> = true;
template <typename T>
inline constexpr bool is_table<const T> = is_table<T>;
template <typename T>
Expand Down
3 changes: 0 additions & 3 deletions src/soagen/hpp/table_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
#include "column_traits.hpp"
#include "row.hpp"
#include "header_start.hpp"
#if SOAGEN_CLANG >= 16
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif

/// @cond
namespace soagen::detail
Expand Down
14 changes: 14 additions & 0 deletions tests/employees.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ using table_traits = employees::table_traits;
};
*/

static_assert(soagen::is_soa<employees>);
static_assert(!soagen::is_table<employees>);
static_assert(soagen::is_table<employees::table_type>);
static_assert(soagen::is_table_traits<employees::table_traits>);
static_assert(std::is_same_v<employees::table_type, soagen::table<employees::table_traits>>);

static_assert(soagen::is_row<employees::row_type>);
static_assert(soagen::is_row<employees::const_row_type>);
static_assert(soagen::is_row<employees::rvalue_row_type>);

static_assert(soagen::is_iterator<employees::iterator>);
static_assert(soagen::is_iterator<employees::const_iterator>);
static_assert(soagen::is_iterator<employees::rvalue_iterator>);

static_assert(std::is_nothrow_default_constructible_v<employees>);
static_assert(std::is_nothrow_move_constructible_v<employees>);
static_assert(std::is_nothrow_move_assignable_v<employees>);
Expand Down

0 comments on commit fd78e5d

Please sign in to comment.