Skip to content

Releases: rollbear/strong_type

v15

07 Jul 20:28
Compare
Choose a tag to compare
  • CMake package is now ARCH_INDEPENDENT, as it should be when it's
    header only. Thank you @PatrickKa for submitting the fix.

  • Much reworked strong::range, which is now compatible with
    std::ranges. This was primarily sparked by a discussion with
    Harald Achitz. Thank you for bringing up the deficiencies.

v14

05 Mar 07:57
Compare
Choose a tag to compare
v14
  • Added several missing [[nodiscard]]

  • .begin() and .end() are now constexpr for strong::range types. Thanks Harald Achitz for reporting the missing specifiers.

  • Added .size() member to strong::range types, if the underlying type has a .size() member. Thanks Harald Achitz for the suggestion.

v13

29 Nov 05:52
Compare
Choose a tag to compare
v13
  • Added static_assert() messages explaining why a modifier cannot be
    used with an underlying type. Thank you @SilmaliTech for suggesting
    the improvement.

  • Added modifier invocable for types with operator(). Thank you
    @DNKpp for the suggestion and the draft implementation.

v12

20 Jul 19:48
Compare
Choose a tag to compare
v12
  • Fixed a bug where fmt formatter function was not const, as it must be
    per the documentation. Thank you Tim Blechmann for submitting the
    fix.

  • Strong types can be weakly_ordered, strongly_ordered and
    partially_ordered, using operator <=> in C++20 and later. Huge thanks
    to Björn Schäpers and Tim Blechmann for the suggestions, discussions
    and infinite patience.

v11

02 May 17:33
Compare
Choose a tag to compare
v11
  • A strong type can now be used as an NTTP (Non Type Template Parameter)
    using type = strong::type<int, struct int_>;
    
    template <type t>
    struct S {
        constexpr operator int() const { return value_of(t);}
    };
    
    int main()
    {
        S<type{3}> obj;
        return obj;
    }
    Thank you Toni Neubert for the implementation.

v10

03 Feb 06:53
Compare
Choose a tag to compare
v10
  • Corrected the test for, and use of, concepts when specializing
    std::numeric_limits<> for strong::arithmetic types. Thank you
    @HazardyKnusperkeks for reporting.

v9

23 Jan 16:45
Compare
Choose a tag to compare
v9
  • Lowered the minimum required CMake version to 3.7, unless unit-tests
    are built.

  • A type predicate strong::type_is_v<type, modifier> has been introduced.
    It can be used in compile time tests for generic code to ensure that
    a strong type has the necessary modifiers. Example:

    using type = strong::type<int, struct type_,
                              strong::ordered,
                              strong::ordered_with<int, long>>;
    static_assert(strong::type_is_v<type, strong::ordered>);
    static_assert(strong::type_is_v<type, strong::ordered_with<long>>);

    Note that for variadic modifiers like strong::ordered_with<>, the
    predicate ensures that all types listed in the test are supported,
    so in the example above, the test type_is_v<type, ordered_with<long>>
    is true because 'long' is included in the type definition using
    ordered_with<int, long>.

    There's also a type version, to use as
    strong::is_type<type, modifier>::value;

  • std::numeric_limits<T> is specialized for types using the
    strong::arithmetic modifier.

  • Added missing const&& overloads for value_of()

v8

04 Jan 16:48
Compare
Choose a tag to compare
v8
  • Split the header file into one file for each modifier. This can
    in some cases speed up compilation times considerably. The header
    file <strong_type/strong_type.hpp> still includes everything, so
    no changes to existing code is necessary.

  • Added new modifier scalable_with<Ts...>. Allows multiplication and
    division with each of the types Ts. If the underlying type can be
    divided, the result will be the first of the type in Ts.

  • difference types are conditionally ordered, if the underlying type
    supports it. Previously they were always ordered, but e.g. a 2D
    vector on a plane is a useful difference type, but it is usually
    not ordered. This change allows the vector in 2D space to be used
    as a difference type.

  • Add CMake alias target strong_type::strong_type

  • Use the CMake option -DSTRONG_TYPE_UNIT_TEST=yes to build unit tests

v7

22 Dec 09:41
Compare
Choose a tag to compare
v7
  • Added missing #include for <fmt/ostream.h>. Thank you Björn Schäpers

  • Fixed MSVC check (typo) for constexpr. Thank you Sergei Soloviev

  • Builds cleanly with -Wconversion

  • Strengthened the unit test suite and CI build structure

v6

21 Oct 15:26
Compare
Choose a tag to compare
v6
  • Added missing strong::is_ostreamable<> predicate needed for fmtlib 9. Thank you Tim Blechman @timblechmann for submitting the fix.