Skip to content

Commit

Permalink
Run clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
Third Party committed Jul 21, 2023
1 parent ed27dd9 commit d034bcc
Showing 1 changed file with 43 additions and 41 deletions.
84 changes: 43 additions & 41 deletions include/llama/Concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@ namespace llama

template<typename M>
concept Mapping = requires(M m) {
typename M::ArrayExtents;
typename M::RecordDim;
{
m.extents()
} -> std::same_as<typename M::ArrayExtents>;
{
+M::blobCount
} -> std::same_as<std::size_t>;
requires isConstexpr<M::blobCount>;
{
m.blobSize(typename M::ArrayExtents::value_type{})
} -> std::same_as<typename M::ArrayExtents::value_type>;
};
typename M::ArrayExtents;
typename M::RecordDim;
{
m.extents()
} -> std::same_as<typename M::ArrayExtents>;
{
+M::blobCount
} -> std::same_as<std::size_t>;
requires isConstexpr<M::blobCount>;
{
m.blobSize(typename M::ArrayExtents::value_type{})
} -> std::same_as<typename M::ArrayExtents::value_type>;
};

template<typename M, typename RC>
concept PhysicalField = requires(M m, typename M::ArrayExtents::Index ai) {
{
m.blobNrAndOffset(ai, RC{})
} -> std::same_as<NrAndOffset<typename M::ArrayExtents::value_type>>;
};
{
m.blobNrAndOffset(ai, RC{})
} -> std::same_as<NrAndOffset<typename M::ArrayExtents::value_type>>;
};

template<typename M>
struct MakeIsPhysical
Expand All @@ -62,15 +62,16 @@ namespace llama
concept AdlTwoStepSwappable = requires(R a, R b) { swap(a, b); } || requires(R a, R b) { std::swap(a, b); };

template<typename R>
concept ProxyReference = std::is_copy_constructible_v<R> && std::is_copy_assignable_v<R> && requires(R r) {
typename R::value_type;
{
static_cast<typename R::value_type>(r)
} -> std::same_as<typename R::value_type>;
{
r = std::declval<typename R::value_type>()
} -> std::same_as<R&>;
} && AdlTwoStepSwappable<R>;
concept ProxyReference = std::is_copy_constructible_v<R> && std::is_copy_assignable_v<R>
&& requires(R r) {
typename R::value_type;
{
static_cast<typename R::value_type>(r)
} -> std::same_as<typename R::value_type>;
{
r = std::declval<typename R::value_type>()
} -> std::same_as<R&>;
} && AdlTwoStepSwappable<R>;

template<typename R>
concept AnyReference = LValueReference<R> || ProxyReference<R>;
Expand All @@ -80,11 +81,12 @@ namespace llama
|| (ProxyReference<R> && std::is_same_v<typename R::value_type, T>);

template<typename M, typename RC>
concept ComputedField = M::isComputed(RC{}) && requires(M m, typename M::ArrayExtents::Index ai, std::byte** blobs) {
{
m.compute(ai, RC{}, blobs)
} -> AnyReferenceTo<GetType<typename M::RecordDim, RC>>;
};
concept ComputedField
= M::isComputed(RC{}) && requires(M m, typename M::ArrayExtents::Index ai, std::byte** blobs) {
{
m.compute(ai, RC{}, blobs)
} -> AnyReferenceTo<GetType<typename M::RecordDim, RC>>;
};

template<typename M>
struct MakeIsComputed
Expand Down Expand Up @@ -117,19 +119,19 @@ namespace llama
/// Additional semantic requirement: &b[i] + j == &b[i + j] for any integral i and j in range of the blob
template<typename B>
concept Blob = requires(B b, std::size_t i) {
// according to http://eel.is/c++draft/intro.object#3 only std::byte and unsigned char can provide storage for
// other types
requires std::is_lvalue_reference_v<decltype(b[i])>;
requires std::same_as<std::remove_cvref_t<decltype(b[i])>, std::byte>
|| std::same_as<std::remove_cvref_t<decltype(b[i])>, unsigned char>;
};
// according to http://eel.is/c++draft/intro.object#3 only std::byte and unsigned char can
// provide storage for other types
requires std::is_lvalue_reference_v<decltype(b[i])>;
requires std::same_as<std::remove_cvref_t<decltype(b[i])>, std::byte>
|| std::same_as<std::remove_cvref_t<decltype(b[i])>, unsigned char>;
};

template<typename BA>
concept BlobAllocator = requires(BA ba, std::size_t size) {
{
ba(std::integral_constant<std::size_t, 16>{}, size)
} -> Blob;
};
{
ba(std::integral_constant<std::size_t, 16>{}, size)
} -> Blob;
};
#endif

namespace internal
Expand Down

0 comments on commit d034bcc

Please sign in to comment.