RxCpp
The Reactive Extensions for Native (RxCpp) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++.
Classes | Namespaces | Macros | Functions | Variables
rx-finally.hpp File Reference

Add a new action at the end of the new observable that is returned. More...

#include "../rx-includes.hpp"
Include dependency graph for rx-finally.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  rxcpp::member_overload< finally_tag >
 

Namespaces

 rxcpp
 
 rxcpp::operators
 

Macros

#define RXCPP_OPERATORS_RX_FINALLY_HPP
 

Functions

template<class... AN>
auto rxcpp::operators::finally (AN &&... an) -> operator_factory< final ly_tag
 

Variables

auto rxcpp::operators::AN
 

Detailed Description

Add a new action at the end of the new observable that is returned.

Template Parameters
LastCallthe type of the action function
Parameters
lcthe action function
Returns
Observable that emits the same items as the source observable, then invokes the given action.
Sample Code\n
auto values = rxcpp::observable<>::range(1, 3).
finally([](){
printf("The final action\n");
});
values.
[](int v){printf("OnNext: %d\n", v);},
[](){printf("OnCompleted\n");});
OnNext: 1
OnNext: 2
OnNext: 3
OnCompleted
The final action
If the source observable generates an error, the final action is still being called:
auto values = rxcpp::observable<>::range(1, 3).
concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
finally([](){
printf("The final action\n");
});
values.
[](int v){printf("OnNext: %d\n", v);},
printf("OnError: %s\n", rxcpp::util::what(ep).c_str());
},
[](){printf("OnCompleted\n");});
OnNext: 1
OnNext: 2
OnNext: 3
OnError: Error from source
The final action

Macro Definition Documentation

◆ RXCPP_OPERATORS_RX_FINALLY_HPP

#define RXCPP_OPERATORS_RX_FINALLY_HPP
rxcpp::util::error_ptr
std::shared_ptr< util::detail::error_base > error_ptr
Definition: rx-util.hpp:874
rxcpp::operators::concat
auto concat(AN &&... an) -> operator_factory< concat_tag, AN... >
Definition: rx-concat.hpp:235
rxcpp::sources::range
auto range(T first=0, T last=std::numeric_limits< T >::max(), std::ptrdiff_t step=1) -> observable< T, detail::range< T, identity_one_worker >>
Definition: rx-range.hpp:119
cpplinq::from
linq_driver< iter_cursor< typename util::container_traits< TContainer >::iterator > > from(TContainer &c)
Definition: linq.hpp:556
rxcpp::operators::subscribe
auto subscribe(ArgN &&... an) -> detail::subscribe_factory< decltype(make_subscriber< T >(std::forward< ArgN >(an)...))>
Definition: rx-subscribe.hpp:87
rxcpp::util::what
std::string what(std::exception_ptr ep)
Definition: rx-util.hpp:544
rxcpp::observable
a source of values. subscribe or use one of the operator methods that return a new observable,...
Definition: rx-observable.hpp:478