• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
2 
3 #pragma once
4 
5 #if !defined(RXCPP_SOURCES_RX_EMPTY_HPP)
6 #define RXCPP_SOURCES_RX_EMPTY_HPP
7 
8 #include "../rx-includes.hpp"
9 
10 /*! \file rx-empty.hpp
11 
12     \brief Returns an observable that sends no items to observer and immediately completes, on the specified scheduler.
13 
14     \tparam T             the type of (not) emitted items
15     \tparam Coordination  the type of the scheduler (optional)
16 
17     \param  cn  the scheduler to use for scheduling the items (optional)
18 
19     \return  Observable that sends no items to observer and immediately completes.
20 
21     \sample
22     \snippet empty.cpp empty sample
23     \snippet output.txt empty sample
24 
25     \sample
26     \snippet empty.cpp threaded empty sample
27     \snippet output.txt threaded empty sample
28 */
29 
30 namespace rxcpp {
31 
32 namespace sources {
33 
34 /*! @copydoc rx-empty.hpp
35  */
36 template<class T>
empty()37 auto empty()
38     -> decltype(from<T>()) {
39     return      from<T>();
40 }
41 /*! @copydoc rx-empty.hpp
42  */
43 template<class T, class Coordination>
empty(Coordination cn)44 auto empty(Coordination cn)
45     -> decltype(from<T>(std::move(cn))) {
46     return      from<T>(std::move(cn));
47 }
48 
49 }
50 
51 }
52 
53 #endif
54