diff --git a/ostd/format.hh b/ostd/format.hh index 235be2a..445ccbc 100644 --- a/ostd/format.hh +++ b/ostd/format.hh @@ -130,7 +130,7 @@ namespace detail { * 7 .. string * 8 .. custom object */ - static constexpr unsigned char const fmt_specs[] = { + inline constexpr unsigned char const fmt_specs[] = { /* uppercase spec set */ 1, 3, 8, 8, /* A B C D */ 1, 1, 1, 8, /* E F G H */ @@ -156,12 +156,12 @@ namespace detail { 0, 0, 0, 0, 0 }; - static constexpr int const fmt_bases[] = { + inline constexpr int const fmt_bases[] = { 0, 0, 0, 2, 8, 10, 16, 0 }; /* non-printable escapes up to 0x20 (space) */ - static constexpr char const *fmt_escapes[] = { + inline constexpr char const *fmt_escapes[] = { "\\0" , "\\x01", "\\x02", "\\x03", "\\x04", "\\x05", "\\x06", "\\a" , "\\b" , "\\t" , "\\n" , "\\v" , "\\f" , "\\r" , "\\x0E", "\\x0F", "\\x10", "\\x11", @@ -217,7 +217,7 @@ namespace detail { std::false_type tuple_like_test(...); template - constexpr bool is_tuple_like = decltype(tuple_like_test(0))::value; + inline constexpr bool is_tuple_like = decltype(tuple_like_test(0))::value; /* test if format traits are available for the type */ template @@ -230,7 +230,7 @@ namespace detail { static std::false_type test_tofmt(...); template - constexpr bool fmt_tofmt_test = decltype(test_tofmt(0))::value; + inline constexpr bool fmt_tofmt_test = decltype(test_tofmt(0))::value; } /** @brief A structure implementing type safe C-style formatting. diff --git a/ostd/range.hh b/ostd/range.hh index 5ecae46..ea941fa 100644 --- a/ostd/range.hh +++ b/ostd/range.hh @@ -186,7 +186,7 @@ namespace detail { }; template - constexpr bool test_range_category = range_category_test::value; + inline constexpr bool test_range_category = range_category_test::value; template struct range_traits_base { @@ -199,7 +199,7 @@ namespace detail { }; template - constexpr bool test_elem_reference = + inline constexpr bool test_elem_reference = std::is_convertible_v && std::is_lvalue_reference_v && std::is_same_v< @@ -388,7 +388,7 @@ using range_reference_t = typename range_traits::reference; * */ template -constexpr bool is_range_element_swappable_with = +inline constexpr bool is_range_element_swappable_with = range_traits::template is_element_swappable_with; /** @brief Checks whether a range can swap elements within itself. @@ -401,7 +401,7 @@ constexpr bool is_range_element_swappable_with = * */ template -constexpr bool is_range_element_swappable = +inline constexpr bool is_range_element_swappable = range_traits::is_element_swappable; /** @brief Checks whether two ranges can nothrow swap elements with each other. @@ -414,7 +414,7 @@ constexpr bool is_range_element_swappable = * */ template -constexpr bool is_range_element_nothrow_swappable_with = +inline constexpr bool is_range_element_nothrow_swappable_with = range_traits::template is_element_nothrow_swappable_with; /** @brief Checks whether a range can nothrow swap elements within itself. @@ -427,21 +427,22 @@ constexpr bool is_range_element_nothrow_swappable_with = * */ template -constexpr bool is_range_element_nothrow_swappable = +inline constexpr bool is_range_element_nothrow_swappable = range_traits::is_element_nothrow_swappable; // is input range namespace detail { template - constexpr bool is_input_range_core = + inline constexpr bool is_input_range_core = std::is_convertible_v, input_range_tag>; template> - constexpr bool is_input_range_base = false; + inline constexpr bool is_input_range_base = false; template - constexpr bool is_input_range_base = detail::is_input_range_core; + inline constexpr bool is_input_range_base = + detail::is_input_range_core; } /** @brief Checks if the given type is an input range or better. @@ -452,20 +453,21 @@ namespace detail { * @see ostd::is_forward_range, ostd::is_output_range */ template -constexpr bool is_input_range = detail::is_input_range_base; +inline constexpr bool is_input_range = detail::is_input_range_base; // is forward range namespace detail { template - constexpr bool is_forward_range_core = + inline constexpr bool is_forward_range_core = std::is_convertible_v, forward_range_tag>; template> - constexpr bool is_forward_range_base = false; + inline constexpr bool is_forward_range_base = false; template - constexpr bool is_forward_range_base = detail::is_forward_range_core; + inline constexpr bool is_forward_range_base = + detail::is_forward_range_core; } /** @brief Checks if the given type is a forward range or better. @@ -476,20 +478,20 @@ namespace detail { * @see ostd::is_input_range, ostd::is_bidirectional_range */ template -constexpr bool is_forward_range = detail::is_forward_range_base; +inline constexpr bool is_forward_range = detail::is_forward_range_base; // is bidirectional range namespace detail { template - constexpr bool is_bidirectional_range_core = + inline constexpr bool is_bidirectional_range_core = std::is_convertible_v, bidirectional_range_tag>; template> - constexpr bool is_bidirectional_range_base = false; + inline constexpr bool is_bidirectional_range_base = false; template - constexpr bool is_bidirectional_range_base = + inline constexpr bool is_bidirectional_range_base = detail::is_bidirectional_range_core; } @@ -500,21 +502,22 @@ namespace detail { * * @see ostd::is_forward_range, ostd::is_random_access_range */ -template constexpr bool is_bidirectional_range = +template +inline constexpr bool is_bidirectional_range = detail::is_bidirectional_range_base; // is random access range namespace detail { template - constexpr bool is_random_access_range_core = + inline constexpr bool is_random_access_range_core = std::is_convertible_v, random_access_range_tag>; template> - constexpr bool is_random_access_range_base = false; + inline constexpr bool is_random_access_range_base = false; template - constexpr bool is_random_access_range_base = + inline constexpr bool is_random_access_range_base = detail::is_random_access_range_core; } @@ -526,21 +529,22 @@ namespace detail { * * @see ostd::is_bidirectional_range, ostd::is_finite_random_access_range */ -template constexpr bool is_random_access_range = +template +inline constexpr bool is_random_access_range = detail::is_random_access_range_base; // is finite random access range namespace detail { template - constexpr bool is_finite_random_access_range_core = + inline constexpr bool is_finite_random_access_range_core = std::is_convertible_v, finite_random_access_range_tag>; template> - constexpr bool is_finite_random_access_range_base = false; + inline constexpr bool is_finite_random_access_range_base = false; template - constexpr bool is_finite_random_access_range_base = + inline constexpr bool is_finite_random_access_range_base = detail::is_finite_random_access_range_core; } @@ -552,21 +556,22 @@ namespace detail { * * @see ostd::is_random_access_range, ostd::is_contiguous_range */ -template constexpr bool is_finite_random_access_range = +template +inline constexpr bool is_finite_random_access_range = detail::is_finite_random_access_range_base; // is contiguous range namespace detail { template - constexpr bool is_contiguous_range_core = + inline constexpr bool is_contiguous_range_core = std::is_convertible_v, contiguous_range_tag>; template> - constexpr bool is_contiguous_range_base = false; + inline constexpr bool is_contiguous_range_base = false; template - constexpr bool is_contiguous_range_base = + inline constexpr bool is_contiguous_range_base = detail::is_contiguous_range_core; } @@ -576,8 +581,8 @@ namespace detail { * * @see ostd::is_finite_random_access_range */ -template constexpr bool is_contiguous_range = - detail::is_contiguous_range_base; +template +inline constexpr bool is_contiguous_range = detail::is_contiguous_range_base; // is output range @@ -591,10 +596,11 @@ namespace detail { static std::false_type test_outrange(...); template - constexpr bool output_range_test = decltype(test_outrange())::value; + inline constexpr bool output_range_test = + decltype(test_outrange())::value; template - constexpr bool is_output_range_core = + inline constexpr bool is_output_range_core = std::is_convertible_v, output_range_tag> || ( is_input_range && ( output_range_test const &> || @@ -604,10 +610,11 @@ namespace detail { ); template> - constexpr bool is_output_range_base = false; + inline constexpr bool is_output_range_base = false; template - constexpr bool is_output_range_base = detail::is_output_range_core; + inline constexpr bool is_output_range_base = + detail::is_output_range_core; } /** @brief Checks if the given type is an output range. @@ -620,7 +627,7 @@ namespace detail { * @see ostd::is_input_range */ template -constexpr bool is_output_range = detail::is_output_range_base; +inline constexpr bool is_output_range = detail::is_output_range_base; namespace detail { // range iterator @@ -1181,13 +1188,16 @@ inline auto zip(R1 &&r1, R &&...rr) { namespace detail { template - static std::true_type test_direct_iter(decltype(std::declval().iter()) *); + static std::true_type test_direct_iter( + decltype(std::declval().iter()) * + ); template static std::false_type test_direct_iter(...); template - constexpr bool direct_iter_test = decltype(test_direct_iter(0))::value; + inline constexpr bool direct_iter_test = + decltype(test_direct_iter(0))::value; template static std::true_type test_std_iter( @@ -1199,7 +1209,8 @@ namespace detail { static std::false_type test_std_iter(...); template - constexpr bool std_iter_test = decltype(test_std_iter(0, 0))::value; + inline constexpr bool std_iter_test = + decltype(test_std_iter(0, 0))::value; /* direct iter and std iter; the case for std iter is * specialized after iterator_range is actually defined @@ -1272,12 +1283,14 @@ inline auto citer(T const &r) -> decltype(ranged_traits::iter(r)) { namespace detail { template - static std::true_type test_iterable(decltype(ostd::iter(std::declval())) *); + static std::true_type test_iterable( + decltype(ostd::iter(std::declval())) * + ); template static std::false_type test_iterable(...); template - constexpr bool iterable_test = decltype(test_iterable(0))::value; + inline constexpr bool iterable_test = decltype(test_iterable(0))::value; } namespace detail {