ReactivePlusPlus
One more implementation of ReactiveX approach in C++ with care about performance and templates in mind
 
Loading...
Searching...
No Matches
take_last.hpp
1// ReactivePlusPlus library
2//
3// Copyright Aleksey Loginov 2022 - present.
4// Distributed under the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at
6// https://www.boost.org/LICENSE_1_0.txt)
7//
8// Project home: https://github.com/victimsnino/ReactivePlusPlus
9//
10
11#pragma once
12
13#include <rpp/observables/details/member_overload.hpp>
14
15namespace rpp::details
16{
17struct take_last_tag;
18}
19
20namespace rpp::details
21{
22template<constraint::decayed_type Type>
23struct take_last_impl;
24
25template<constraint::decayed_type Type, typename SpecificObservable>
26struct member_overload<Type, SpecificObservable, take_last_tag>
27{
60 template<typename ...Args>
61 auto take_last(size_t count) const & requires is_header_included<take_last_tag, Args...>
62 {
63 return static_cast<const SpecificObservable*>(this)->template lift<Type>(take_last_impl<Type>{count});
64 }
65
66 template<typename ...Args>
67 auto take_last(size_t count) && requires is_header_included<take_last_tag, Args...>
68 {
69 return std::move(*static_cast<SpecificObservable*>(this)).template lift<Type>(take_last_impl<Type>{count});
70 }
71};
72} // namespace rpp::details
Definition: member_overload.hpp:19
Definition: take_last.hpp:80