-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add tuple_for_each * Use maybe_const * Add views::zip, ranges::zip_view * Update zip_view.hpp * Update zip_view.hpp * Add to_array * Create three_way_comparable.hpp * Fix zip_view * Add zip_transfrom_view * Add find_last * Update zip_transform_view.hpp * Add ranges::find_end * Add ranges:: find_first_of * Update algorithm_test.cpp * Create debug_assert.hpp * Update doxy * Create ignore_dumb_diagnostics_pop.hpp * Create ignore_dumb_diagnostics_push.hpp * Update tuple_for_each.hpp * Update tuple_transform.hpp * Fix iter_move, iter_swap * Update iterator_test.cpp * Fix error * Update transform_view.hpp * Fix pragma warning * Update join_with_view.hpp * Update transform_view.hpp * Update transform_view.hpp * Update fold_left.hpp * Update non_propagating_cache.hpp * Update indirectly_swappable.hpp * Add ranges::make_heap * Add pop_heap * Add ranges::sort_heap * Update debug_assert.hpp * Update equal_to.hpp * Update cxx20_rel_ops.hpp * Add ranges::sort * Add saturate_cast * Add ranges::contains, ranges::contains_subrange * Update zip_view.hpp * Update saturate_cast.hpp * Update saturate_cast.hpp * Update counted_iterator.hpp * Update take_view.hpp * Add missing comparison operators * Fix ssize * Update from_range.hpp * Update string_view.hpp * Update emscripten from 3.1.34 -> 3.1.57 * Update from_range.hpp * Update from_range.hpp * Update expected.hpp * Add logging with custom tag * Add cmp_xxx * Add is_character * Update cmp.hpp * Add in_range * Add ranges::clamp * Update cmp.hpp * Update in_range.hpp * Update filter_view.hpp * Fix filter_view::iterator::iterator_category * Fix elements_view::iterator::iterator_category * Fix join_view::iterator::iterator_category * Add tuple_for_each_index * fix cmp_xxx * Add copy_template * Add sequence_for_each * Add bind * Add test * Update string_view.hpp * Update docs * Update version_history.txt * Update version_history.txt * Add missing groups * Update mainpage.txt * Update header.html
- Loading branch information
Showing
132 changed files
with
4,031 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ on: | |
|
||
env: | ||
BUILD_TYPE: Release | ||
EMSDK_VERSION: 3.1.34 | ||
EMSDK_VERSION: 3.1.57 | ||
|
||
jobs: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// | ||
// Created by YongGyu Lee on 5/8/24. | ||
// | ||
|
||
#ifndef VCCC_ALGORITHM_RANGES_CLAMP_HPP_ | ||
#define VCCC_ALGORITHM_RANGES_CLAMP_HPP_ | ||
|
||
#include <utility> | ||
|
||
#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/projected.hpp" | ||
#include "vccc/__type_traits/conjunction.hpp" | ||
|
||
namespace vccc { | ||
namespace ranges { | ||
namespace detail { | ||
|
||
struct clamp_niebloid { | ||
template<typename T, typename Proj = identity, typename Comp = ranges::less, std::enable_if_t<conjunction< | ||
projectable<const T*, Proj>, | ||
indirect_strict_weak_order<Comp, projected<const T*, Proj>> | ||
>::value, int> = 0> | ||
constexpr const T& operator()(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}) const { | ||
auto&& pv = vccc::invoke(proj, v); | ||
|
||
if (vccc::invoke(comp, std::forward<decltype(pv)>(pv), vccc::invoke(proj, lo))) | ||
return lo; | ||
|
||
if (vccc::invoke(comp, vccc::invoke(proj, hi), std::forward<decltype(pv)>(pv))) | ||
return hi; | ||
|
||
return v; | ||
} | ||
}; | ||
|
||
} // namespace detail | ||
|
||
/// @addtogroup algorithm | ||
/// @{ | ||
|
||
/** | ||
@brief clamps a value between a pair of boundary values | ||
If `v` compares less than `lo`, returns `lo`; otherwise if `hi` compares less than `v`, returns `hi`; otherwise returns `v`. | ||
The behavior is undefined if `lo` is greater than `hi`. | ||
<H1>Complexity</H1> | ||
At most two comparisons and three applications of the projection. | ||
@sa [std::ranges::clamp](https://en.cppreference.com/w/cpp/algorithm/ranges/clamp) | ||
@sa [std::clamp](https://en.cppreference.com/w/cpp/algorithm/clamp) | ||
@sa vccc::clamp | ||
*/ | ||
VCCC_INLINE_OR_STATIC constexpr detail::clamp_niebloid clamp{}; | ||
|
||
/// @} | ||
|
||
} // namespace ranges | ||
} // namespace vccc | ||
|
||
#endif // VCCC_ALGORITHM_RANGES_CLAMP_HPP_ |
Oops, something went wrong.