43 #pragma qt_sync_skip_header_check
44 #pragma qt_sync_stop_processing
47 #ifndef QCONTAINERTOOLS_IMPL_H
48 #define QCONTAINERTOOLS_IMPL_H
50 #include <QtCore/qglobal.h>
51 #include <QtCore/qtypeinfo.h>
69 template<
typename T,
typename Cmp = std::less<>>
70 static constexpr
bool q_points_into_range(
const T *
p,
const T *
b,
const T *
e,
71 Cmp less = {}) noexcept
73 return !less(
p,
b) && less(
p,
e);
76 template <
typename T,
typename N>
79 if constexpr (std::is_nothrow_move_constructible_v<T> || !std::is_copy_constructible_v<T>)
85 template <
typename T,
typename N>
91 static_cast<const void*
>(
first),
101 template<
typename iterator,
typename N>
128 void freeze() noexcept
130 intermediate = *
iter;
131 iter = std::addressof(intermediate);
133 ~Destructor() noexcept
140 } destroyer(d_first);
147 auto pair = std::minmax(d_last,
first);
155 while (d_first != overlapBegin) {
157 new (std::addressof(*d_first))
T(std::move_if_noexcept(*
first));
167 while (d_first != d_last) {
168 *d_first = std::move_if_noexcept(*
first);
176 while (
first != overlapEnd)
190 template<
typename T,
typename N>
193 static_assert(std::is_nothrow_destructible_v<T>,
194 "This algorithm requires that T has a non-throwing destructor");
196 if (
n ==
N(0) ||
first == d_first ||
first ==
nullptr || d_first ==
nullptr)
200 std::memmove(
static_cast<void *
>(d_first),
static_cast<const void *
>(
first),
n *
sizeof(
T));
202 if (d_first <
first) {
205 auto rfirst = std::make_reverse_iterator(
first +
n);
206 auto rd_first = std::make_reverse_iterator(d_first +
n);
212 template <
typename Iterator>
214 std::is_convertible<typename std::iterator_traits<Iterator>::iterator_category, std::input_iterator_tag>
::value,
217 template <
typename Iterator>
219 std::is_convertible<typename std::iterator_traits<Iterator>::iterator_category, std::forward_iterator_tag>
::value,
222 template <
typename Iterator>
224 !std::is_convertible<typename std::iterator_traits<Iterator>::iterator_category, std::forward_iterator_tag>
::value,
228 typename InputIterator,
235 typename ForwardIterator,
236 IfIsForwardIterator<ForwardIterator> =
true>
239 c->reserve(
static_cast<typename Container::size_type
>(
std::distance(
f,
l)));
242 template <
typename Iterator,
typename = std::
void_t<>>
247 template <
typename Iterator>
250 std::void_t<decltype(std::declval<Iterator &>().key()),
251 decltype(std::declval<Iterator &>().value())>
257 template <
typename Iterator,
typename = std::
void_t<>,
typename = std::
void_t<>>
262 template <
typename Iterator>
265 std::void_t<decltype(std::declval<Iterator &>()->first),
266 decltype(std::declval<Iterator &>()->second)>
272 template <
typename Iterator>
276 template <
typename Iterator>
280 template <
typename T,
typename U>
284 template<
typename T,
typename U>
287 template <
typename Container,
typename Predicate>
295 const auto cbegin =
c.cbegin();
296 const auto cend =
c.cend();
297 const auto t_it = std::find_if(
cbegin,
cend, pred);
303 const auto e =
c.end();
314 *dest = std::move(*
it);
324 template <
typename Container,
typename T>
328 auto cmp = [&](
auto &
e) {
return e ==
t; };
332 template <
typename Container,
typename T>
335 using CopyProxy = std::conditional_t<std::is_copy_constructible_v<T>,
T,
const T &>;
336 const T &tCopy = CopyProxy(
t);
340 template <
typename Container,
typename T>
343 const auto cend =
c.cend();
351 template <
typename T,
typename Predicate>
355 auto it =
set.begin();
356 const auto e =
set.end();
370 template <
typename R,
typename F,
typename ... ArgTypes>
376 template <
typename R,
typename F,
typename ... ArgTypes>
378 std::is_invocable<
F, ArgTypes...>,
382 template <
typename Container,
typename Predicate>
390 using KeyValuePair = std::pair<const Key &, Value &>;
392 typename Container::size_type
result = 0;
395 const auto e =
c.end();
397 if constexpr (is_invocable_explicit_r_v<bool, Predicate &, Iterator &>) {
404 }
else if constexpr (is_invocable_explicit_r_v<bool, Predicate &, KeyValuePair &&>) {
405 KeyValuePair
p(
it.key(),
it.value());
406 if (pred(std::move(
p))) {
413 static_assert(
sizeof(
Container) == 0,
"Predicate has an incompatible signature");
Generic::PredicateMatcher< T > Predicate(std::function< bool(T const &)> const &predicate, std::string const &description="")
typename C::value_type value_type
typename C::key_type key_type
typename C::mapped_type mapped_type
typename C::iterator iterator
const PluginKeyMapConstIterator cend
auto associative_erase_if(Container &c, Predicate &pred)
typename std::enable_if< AssociativeIteratorHasKeyAndValue< Iterator >::value, bool >::type IfAssociativeIteratorHasKeyAndValue
void q_uninitialized_relocate_n(T *first, N n, T *out)
qsizetype qset_erase_if(QSet< T > &set, Predicate &pred)
void q_uninitialized_move_if_noexcept_n(T *first, N n, T *out)
auto sequential_erase_one(Container &c, const T &t)
typename std::enable_if<!std::is_same< T, U >::value, bool >::type IfIsNotSame
typename std::enable_if<!std::is_convertible< T, U >::value, bool >::type IfIsNotConvertible
void q_relocate_overlap_n_left_move(iterator first, N n, iterator d_first)
typename std::enable_if< !std::is_convertible< typename std::iterator_traits< Iterator >::iterator_category, std::forward_iterator_tag >::value, bool >::type IfIsNotForwardIterator
auto sequential_erase_if(Container &c, Predicate &pred)
auto sequential_erase_with_copy(Container &c, const T &t)
typename std::enable_if< AssociativeIteratorHasFirstAndSecond< Iterator >::value, bool >::type IfAssociativeIteratorHasFirstAndSecond
auto sequential_erase(Container &c, const T &t)
typename std::enable_if< std::is_convertible< typename std::iterator_traits< Iterator >::iterator_category, std::input_iterator_tag >::value, bool >::type IfIsInputIterator
typename std::enable_if< std::is_convertible< typename std::iterator_traits< Iterator >::iterator_category, std::forward_iterator_tag >::value, bool >::type IfIsForwardIterator
void q_relocate_overlap_n(T *first, N n, T *d_first)
void reserveIfForwardIterator(Container *, InputIterator, InputIterator)
constexpr bool is_invocable_explicit_r_v
decltype(auto) cbegin(const T &t)
int distance(TestIterator &a, TestIterator &b)
void *PRIV() memmove(void *d, const void *s, size_t n)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter * iter
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLsizei GLsizei GLsizei GLboolean commit
QFuture< QSet< QChar > > set
[10]
QTextStream out(stdout)
[7]
QDomElement find(const QString &tagName, const QDomElement &e)