Skip to content

Commit

Permalink
Update vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed Apr 26, 2024
1 parent 6fe7ed4 commit 00297df
Show file tree
Hide file tree
Showing 10 changed files with 608 additions and 526 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
# The variable CVF_VERSION must be set before calling configure_file().


set(PACKAGE_VERSION "1.3.1")
set(PACKAGE_VERSION "1.3.4")

if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()

if("1.3.1" MATCHES "^([0-9]+)\\.")
if("1.3.4" MATCHES "^([0-9]+)\\.")
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
endif()
else()
set(CVF_VERSION_MAJOR "1.3.1")
set(CVF_VERSION_MAJOR "1.3.4")
endif()

if(PACKAGE_FIND_VERSION_RANGE)
Expand Down Expand Up @@ -53,13 +53,13 @@ endif()


# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "" STREQUAL "")
return()
endif()

# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
math(EXPR installedBits "8 * 8")
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "")
math(EXPR installedBits " * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ namespace detail
return flag_set_impl(int_type(0));
}

static constexpr flag_set_impl from_int(int_type intVal)
{
return flag_set_impl(int_type(intVal));
}

explicit constexpr flag_set_impl(const Enum& e) : bits_(mask(e)) {}
template <typename Tag2>
explicit constexpr flag_set_impl(const flag_set_impl<Enum, Tag2>& other)
Expand Down Expand Up @@ -416,6 +421,17 @@ class flag_set
static_assert(flag_set_traits<Enum>::value, "invalid enum for flag_set");

public:
using int_type = typename detail::flag_set_impl<Enum>::int_type;

/// \returns a flag_set based on the given integer value.
/// \requires `T` must be of the same type as `int_type`.
template <typename T>
static constexpr flag_set from_int(T intVal)
{
static_assert(std::is_same<T, int_type>::value, "invalid integer type, lossy conversion");
return flag_set(intVal);
}

//=== constructors/assignment ===//
/// \effects Creates a set where all flags are set to `0`.
/// \group ctor_null
Expand Down Expand Up @@ -609,6 +625,9 @@ class flag_set
}

private:
explicit constexpr flag_set(int_type rawvalue) noexcept : flags_(detail::flag_set_impl<Enum>::from_int(rawvalue))
{}

detail::flag_set_impl<Enum> flags_;

friend detail::get_flag_set_impl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,20 @@ namespace detail
template <typename Signature>
class function_ref;

namespace detail
{
template<typename>
struct function_ref_trait { using type = void; };

template<typename Signature>
struct function_ref_trait<function_ref<Signature>>
{
using type = function_ref<Signature>;

using return_type = typename type::return_type;
};
} // namespace detail

/// A reference to a function.
///
/// This is a lightweight reference to a function.
Expand All @@ -549,6 +563,8 @@ template <typename Return, typename... Args>
class function_ref<Return(Args...)>
{
public:
using return_type = Return;

using signature = Return(Args...);

/// \effects Creates a reference to the function specified by the function pointer.
Expand Down Expand Up @@ -596,10 +612,15 @@ class function_ref<Return(Args...)>
/// unless the functor is compatible with the specified signature.
/// \param 1
/// \exclude
template <typename Functor, typename = detail::enable_function_tag<detail::matching_functor_tag,
Functor, Return, Args...>>
template <
typename Functor,
typename = detail::enable_function_tag<detail::matching_functor_tag, Functor, Return, Args...>,
// This overload restricts us to not directly referencing another function_ref.
typename std::enable_if<std::is_same<typename detail::function_ref_trait<Functor>::type, void>::value, int>::type = 0
>
explicit function_ref(Functor& f) : cb_(&invoke_functor<Functor>)
{
// Ref to this functor
::new (storage_.get()) void*(&f);
}

Expand All @@ -612,13 +633,20 @@ class function_ref<Return(Args...)>
/// `std::string`. If this signature than accepts a type `T` implicitly convertible to `const
/// char*`, calling this will call the function taking `std::string`, converting `T ->
/// std::string`, even though such a conversion would be ill-formed otherwise. \param 1 \exclude
template <typename Return2, typename... Args2>
explicit function_ref(
const function_ref<Return2(Args2...)>& other,
typename std::enable_if<detail::compatible_return_type<Return2, Return>::value, int>::type
= 0)
: storage_(other.storage_), cb_(other.cb_)
{}
template <
typename Functor,
// This overloading allows us to directly referencing another function_ref.
typename std::enable_if<!std::is_same<typename detail::function_ref_trait<Functor>::type, void>::value, int>::type = 0,
// Requires that the signature not be consistent (if it is then the copy construct should be called).
typename std::enable_if<!std::is_same<typename detail::function_ref_trait<Functor>::type, function_ref>::value, int>::type = 0,
// Of course, the return type and parameter types must be compatible.
typename = detail::enable_function_tag<detail::matching_functor_tag, Functor, Return, Args...>
>
explicit function_ref(Functor& f) : cb_(&invoke_functor<Functor>)
{
// Ref to this function_ref
::new (storage_.get()) void*(&f);
}

/// \effects Rebinds the reference to the specified functor.
/// \notes This assignment operator only participates in overload resolution,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ using underlying_type
/// \group is_strong_typedef
/// Whether a type `T` is a [ts::strong_type]()
template <class T, typename = detail::void_t<>>
struct TYPE_SAFE_MSC_EMPTY_BASES is_strong_typedef : std::false_type
struct is_strong_typedef : std::false_type
{};

/// \group is_strong_typedef
Expand Down Expand Up @@ -425,43 +425,43 @@ namespace strong_typedef_op
/// \exclude
#define TYPE_SAFE_DETAIL_MAKE_STRONG_TYPEDEF_OP(Name, Op) \
template <class StrongTypedef> \
struct Name \
struct TYPE_SAFE_MSC_EMPTY_BASES Name \
{}; \
TYPE_SAFE_DETAIL_MAKE_OP(Op, Name, StrongTypedef) \
TYPE_SAFE_DETAIL_MAKE_OP_COMPOUND(Op## =, Name) \
template <class StrongTypedef, typename Other> \
struct mixed_##Name \
struct TYPE_SAFE_MSC_EMPTY_BASES mixed_##Name \
{}; \
TYPE_SAFE_DETAIL_MAKE_OP_MIXED(Op, mixed_##Name, StrongTypedef) \
TYPE_SAFE_DETAIL_MAKE_OP_COMPOUND_MIXED(Op## =, mixed_##Name) \
template <class StrongTypedef, typename Other> \
struct mixed_##Name##_noncommutative \
struct TYPE_SAFE_MSC_EMPTY_BASES mixed_##Name##_noncommutative \
{}; \
TYPE_SAFE_DETAIL_MAKE_OP_STRONGTYPEDEF_OTHER(Op, mixed_##Name##_noncommutative, StrongTypedef) \
TYPE_SAFE_DETAIL_MAKE_OP_COMPOUND_MIXED(Op## =, mixed_##Name##_noncommutative)

template <class StrongTypedef>
struct equality_comparison
struct TYPE_SAFE_MSC_EMPTY_BASES equality_comparison
{};
TYPE_SAFE_DETAIL_MAKE_OP(==, equality_comparison, bool)
TYPE_SAFE_DETAIL_MAKE_OP(!=, equality_comparison, bool)

template <class StrongTypedef, typename Other>
struct mixed_equality_comparison
struct TYPE_SAFE_MSC_EMPTY_BASES mixed_equality_comparison
{};
TYPE_SAFE_DETAIL_MAKE_OP_MIXED(==, mixed_equality_comparison, bool)
TYPE_SAFE_DETAIL_MAKE_OP_MIXED(!=, mixed_equality_comparison, bool)

template <class StrongTypedef>
struct relational_comparison
struct TYPE_SAFE_MSC_EMPTY_BASES relational_comparison
{};
TYPE_SAFE_DETAIL_MAKE_OP(<, relational_comparison, bool)
TYPE_SAFE_DETAIL_MAKE_OP(<=, relational_comparison, bool)
TYPE_SAFE_DETAIL_MAKE_OP(>, relational_comparison, bool)
TYPE_SAFE_DETAIL_MAKE_OP(>=, relational_comparison, bool)

template <class StrongTypedef, typename Other>
struct mixed_relational_comparison
struct TYPE_SAFE_MSC_EMPTY_BASES mixed_relational_comparison
{};
TYPE_SAFE_DETAIL_MAKE_OP_MIXED(<, mixed_relational_comparison, bool)
TYPE_SAFE_DETAIL_MAKE_OP_MIXED(<=, mixed_relational_comparison, bool)
Expand All @@ -475,7 +475,7 @@ namespace strong_typedef_op
TYPE_SAFE_DETAIL_MAKE_STRONG_TYPEDEF_OP(modulo, %)

template <class StrongTypedef>
struct explicit_bool
struct TYPE_SAFE_MSC_EMPTY_BASES explicit_bool
{
/// \exclude
explicit constexpr operator bool() const
Expand All @@ -486,7 +486,7 @@ namespace strong_typedef_op
};

template <class StrongTypedef>
struct increment
struct TYPE_SAFE_MSC_EMPTY_BASES increment
{
/// \exclude
TYPE_SAFE_CONSTEXPR14 StrongTypedef& operator++()
Expand All @@ -506,7 +506,7 @@ namespace strong_typedef_op
};

template <class StrongTypedef>
struct decrement
struct TYPE_SAFE_MSC_EMPTY_BASES decrement
{
/// \exclude
TYPE_SAFE_CONSTEXPR14 StrongTypedef& operator--()
Expand All @@ -526,7 +526,7 @@ namespace strong_typedef_op
};

template <class StrongTypedef>
struct unary_plus
struct TYPE_SAFE_MSC_EMPTY_BASES unary_plus
{};

/// \exclude
Expand All @@ -543,7 +543,7 @@ namespace strong_typedef_op
}

template <class StrongTypedef>
struct unary_minus
struct TYPE_SAFE_MSC_EMPTY_BASES unary_minus
{};

/// \exclude
Expand Down Expand Up @@ -581,7 +581,7 @@ namespace strong_typedef_op
{};

template <class StrongTypedef>
struct complement
struct TYPE_SAFE_MSC_EMPTY_BASES complement
{};

/// \exclude
Expand Down Expand Up @@ -609,7 +609,7 @@ namespace strong_typedef_op
{};

template <class StrongTypedef, typename IntT>
struct bitshift
struct TYPE_SAFE_MSC_EMPTY_BASES bitshift
{};
TYPE_SAFE_DETAIL_MAKE_OP_MIXED(<<, bitshift, StrongTypedef)
TYPE_SAFE_DETAIL_MAKE_OP_MIXED(>>, bitshift, StrongTypedef)
Expand All @@ -618,7 +618,7 @@ namespace strong_typedef_op

template <class StrongTypedef, typename Result, typename ResultPtr = Result*,
typename ResultConstPtr = const Result*>
struct dereference
struct TYPE_SAFE_MSC_EMPTY_BASES dereference
{
/// \exclude
Result& operator*()
Expand Down Expand Up @@ -650,7 +650,7 @@ namespace strong_typedef_op
};

template <class StrongTypedef, typename Result, typename Index = std::size_t>
struct array_subscript
struct TYPE_SAFE_MSC_EMPTY_BASES array_subscript
{
/// \exclude
Result& operator[](const Index& i)
Expand Down Expand Up @@ -752,7 +752,7 @@ namespace strong_typedef_op
};

template <class StrongTypedef>
struct input_operator
struct TYPE_SAFE_MSC_EMPTY_BASES input_operator
{
/// \exclude
template <typename Char, class CharTraits>
Expand All @@ -765,7 +765,7 @@ namespace strong_typedef_op
};

template <class StrongTypedef>
struct output_operator
struct TYPE_SAFE_MSC_EMPTY_BASES output_operator
{
/// \exclude
template <typename Char, class CharTraits>
Expand Down
Loading

0 comments on commit 00297df

Please sign in to comment.