Skip to content

Commit

Permalink
1.3.4 (#121)
Browse files Browse the repository at this point in the history
* Add common_iterator

* Update variant.hpp

* init common_view

* Update variant.hpp

* Add LOGXD

* Create memory.hpp

* Update logger.hpp

* Fix common_iterator

* Fix common_iterator

* Update common_iterator.hpp

* Add ranges::common_view, views::common

* Add ranges::rbegin

* Update rbegin

* Update rbegin.hpp

* Update rbegin.hpp

* Add is_class_or_enum

* Update not_incomplete_array.hpp

* Add ranges::rend

* Add ranges::reverse_view

* Update reverse_view.hpp

* Add is_subrange

* Add views::reverse

* Update ranges_test.cpp

* Update ranges_test.cpp

* Add ranges::join_with_view, views::join_with

* Fix error

* Update join_with_view.hpp

* Add concat_view

* Add concat_view

* Update concat_view.hpp

* Update concat_view.hpp

* Update ranges_test.cpp

* Update ranges_test.cpp

* Fix views::split

* Update concepts.hpp

* Update concat_view.hpp

* Update non_propagating_cache.hpp

* Add drop_while_view, drop_while

* Update drop_while_view.hpp

* Update concat

* Add tuple algorithm

* Update concat_view.hpp

* Update concat_view.hpp

* Fix common_reference

* Fix common_type

* Move maybe_const

* Update tuple_like.hpp

* Add key, value

* Add ranges:: lexicographical_compare

* Fix hard error of indirectly_readable

* Update basic_const_iterator.hpp

* Support ranges for type_support

* Fix unnecessary forwarding
  • Loading branch information
lackhole committed Feb 27, 2024
1 parent 89bc8d5 commit 480bddd
Show file tree
Hide file tree
Showing 70 changed files with 3,732 additions and 287 deletions.
8 changes: 7 additions & 1 deletion include/log/include/vccc/__log/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,14 @@ class Logger {
*/
constexpr Logger Log;

/// @defgroup log_log_macro__macro__Logging_macros LOGD, LOGI, LOGW, LOGE
/// @defgroup log_log_macro__macro__Logging_macros LOGD, LOGI, LOGID, LOGW, LOGWD, LOGE, LOGED
/// @{

# ifdef NDEBUG
# define LOGD(...)
# define LOGID(...)
# define LOGWD(...)
# define LOGED(...)
#else
/**
*
Expand All @@ -115,6 +118,9 @@ Below example applies to LOGI, LOGW, LOGE
@endcode
*/
# define LOGD(...) ::vccc::Log.d(__VA_ARGS__)
# define LOGID(...) ::vccc::Log.i(__VA_ARGS__)
# define LOGWD(...) ::vccc::Log.w(__VA_ARGS__)
# define LOGED(...) ::vccc::Log.e(__VA_ARGS__)
# endif

/** @brief Information log wrapper **/
Expand Down
2 changes: 1 addition & 1 deletion include/type_support/include/vccc/__type_support/at.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# ifndef VCCC_TYPE_SUPPORT_AT_HPP
# define VCCC_TYPE_SUPPORT_AT_HPP
#
# include "vccc/__type_support/detail/container_at.hpp"
# include "vccc/__type_support/detail/range_at.hpp"
# include "vccc/__type_support/core.hpp"
# include "vccc/__type_support/cast.hpp"
# include "vccc/type_traits.hpp"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# /*
# * Created by YongGyu Lee on 2020/12/08.
# */
#
# ifndef VCCC_TYPE_SUPPORT_DETAIL_RANGE_AT_HPP
# define VCCC_TYPE_SUPPORT_DETAIL_RANGE_AT_HPP
#
# include <type_traits>
# include <utility>
#
# include "vccc/ranges.hpp"
# include "vccc/utility.hpp"

namespace vccc {

/**
@addtogroup type_support_at__func
@{
@defgroup type_support_at_container__func vccc::at (container)
Index-based value accessor
@{
*/
template<std::size_t i, typename R, std::enable_if_t<ranges::range<R>::value, int> = 0>
decltype(auto)
at(R&& container)
{
BOUNDS_ASSERT(i, ranges::distance(container));
return *ranges::next(ranges::begin(container), i);
}

//! @}
//! @} type_support

}

# endif // VCCC_TYPE_SUPPORT_DETAIL_RANGE_AT_HPP
87 changes: 87 additions & 0 deletions include/vccc/__algorithm/ranges/lexicographical_compare.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
//
// Created by YongGyu Lee on 2/24/24.
//

#ifndef VCCC_ALGORITHM_RANGES_LEXICOGRAPHICAL_COMPARE_HPP
#define VCCC_ALGORITHM_RANGES_LEXICOGRAPHICAL_COMPARE_HPP

#include <functional>
#include <type_traits>

#include "vccc/__core/inline_or_static.hpp"
#include "vccc/__functional/identity.hpp"
#include "vccc/__functional/invoke.hpp"
#include "vccc/__functional/less.hpp"
#include "vccc/__iterator/indirect_strict_weak_order.hpp"
#include "vccc/__iterator/input_iterator.hpp"
#include "vccc/__iterator/projected.hpp"
#include "vccc/__iterator/sentinel_for.hpp"
#include "vccc/__ranges/begin.hpp"
#include "vccc/__ranges/end.hpp"
#include "vccc/__utility/cxx20_rel_ops.hpp"

namespace vccc {
namespace ranges {
namespace detail {

struct lexicographical_compare_niebloid {
private:
template<typename I1, typename Proj1, typename I2, typename Proj2, typename Comp,
bool = conjunction<projectable<I1, Proj1>, projectable<I2, Proj2>>::value /* false_type */>
struct test_projectable_iterator : std::false_type {};
template<typename I1, typename Proj1, typename I2, typename Proj2, typename Comp>
struct test_projectable_iterator<I1, Proj1, I2, Proj2, Comp, true>
: indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>> {};

template<typename R1, typename Proj1, typename R2, typename Proj2, typename Comp,
bool = conjunction<input_range<R1>, input_range<R2>>::value /* false_type */>
struct test_projectable_range : std::false_type {};
template<typename R1, typename Proj1, typename R2, typename Proj2, typename Comp>
struct test_projectable_range<R1, Proj1, R2, Proj2, Comp, true>
: test_projectable_iterator<iterator_t<R1>, Proj1, iterator_t<R2>, Proj2, Comp> {};

public:
template<
typename I1, typename S1,
typename I2, typename S2,
typename Proj1 = identity, typename Proj2 = identity, typename Comp = ranges::less,
std::enable_if_t<conjunction<
input_iterator<I1>, sentinel_for<S1, I1>,
input_iterator<I2>, sentinel_for<S2, I2>,
test_projectable_iterator<I1, Proj1, I2, Proj2, Comp>
>::value, int> = 0
>
constexpr bool operator()(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) const {
using namespace rel_ops;
for (; (first1 != last1) && (first2 != last2); ++first1, (void) ++first2) {
if (vccc::invoke(comp, vccc::invoke(proj1, *first1), vccc::invoke(proj2, *first2)))
return true;
if (vccc::invoke(comp, vccc::invoke(proj2, *first2), vccc::invoke(proj1, *first1)))
return false;
}
return (first1 == last1) && (first2 != last2);
}

template<typename R1, typename R2, typename Proj1 = identity, typename Proj2 = identity, typename Comp = less, std::enable_if_t<
test_projectable_range<R1, Proj1, R2, Proj2, Comp>
::value, int> = 0>
constexpr bool operator()(R1&& r1, R2&& r2, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) const {
return (*this)(ranges::begin(r1), ranges::end(r1), ranges::begin(r2), ranges::end(r2), std::ref(comp), std::ref(proj1), std::ref(proj2));
}

};

} // namespace detail

/// @addtogroup algorithm
/// @{

/// @brief returns `true` if one range is lexicographically less than another
VCCC_INLINE_OR_STATIC constexpr detail::lexicographical_compare_niebloid lexicographical_compare{};

/// @}

} // namespace ranges
} // namespace vccc

#endif // VCCC_ALGORITHM_RANGES_LEXICOGRAPHICAL_COMPARE_HPP
2 changes: 1 addition & 1 deletion include/vccc/__concepts/common_reference_with.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ template<
typename U,
bool = conjunction<
has_typename_type<common_reference<T, U>>,
has_typename_type<common_reference<T, U>>
has_typename_type<common_reference<U, T>>
>::value /* false */
>
struct common_reference_with_impl : std::false_type {};
Expand Down
5 changes: 3 additions & 2 deletions include/vccc/__concepts/swap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "vccc/__type_traits/conjunction.hpp"
#include "vccc/__type_traits/disjunction.hpp"
#include "vccc/__type_traits/negation.hpp"
#include "vccc/__type_traits/is_class_or_enum.hpp"

namespace vccc {
namespace ranges {
Expand All @@ -32,8 +33,8 @@ template<typename T, typename U>
constexpr auto test_swap(...) -> std::false_type;

template<typename T, typename U, bool = disjunction<
std::is_class<remove_cvref_t<T>>, std::is_enum<remove_cvref_t<T>>,
std::is_class<remove_cvref_t<U>>, std::is_enum<remove_cvref_t<U>> >::value>
is_class_or_enum<remove_cvref_t<T>>,
is_class_or_enum<remove_cvref_t<U>>>::value>
struct adl_swappable : std::false_type {};

template<typename T, typename U>
Expand Down
8 changes: 6 additions & 2 deletions include/vccc/__iterator/basic_const_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ struct basic_const_iterator_category {
};

template<typename Iter>
struct basic_const_iterator_category<Iter, false> {};
struct basic_const_iterator_category<Iter, false> {
#if __cplusplus < 202002L
using iterator_category = iterator_ignore;
#endif
};

template<typename Iter>
struct basic_const_iterator_concept {
Expand Down Expand Up @@ -89,14 +93,14 @@ struct const_iterator_implicit_conversion_check<Class, Other, Iter, true>

template<typename Iter>
class basic_const_iterator : public detail::basic_const_iterator_category<Iter> {
using reference = iter_const_reference_t<Iter>;
using rvalue_reference = common_reference_t<const iter_value_t<Iter>&&, iter_rvalue_reference_t<Iter>>;
public:
static_assert(input_iterator<Iter>::value, "Constraints not satisfied");

using iterator_concept = typename detail::basic_const_iterator_concept<Iter>::iterator_concept;
using value_type = iter_value_t<Iter>;
using difference_type = iter_difference_t<Iter>;
using reference = iter_const_reference_t<Iter>;

basic_const_iterator() = default;

Expand Down
Loading

0 comments on commit 480bddd

Please sign in to comment.