summaryrefslogtreecommitdiff
path: root/Rx/v2/src/rxcpp/sources/rx-never.hpp
blob: ea343996de20db0c5f5e356c92665b50b44d5f53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

#pragma once

#if !defined(RXCPP_SOURCES_RX_NEVER_HPP)
#define RXCPP_SOURCES_RX_NEVER_HPP

#include "../rx-includes.hpp"

/*! \file rx-never.hpp

    \brief Returns an observable that never sends any items or notifications to observer.

    \tparam T  the type of (not) emitted items

    \return  Observable that never sends any items or notifications to observer.

    \sample
    \snippet never.cpp never sample
    \snippet output.txt never sample
*/

namespace rxcpp {

namespace sources {

namespace detail {

template<class T>
struct never : public source_base<T>
{
    template<class Subscriber>
    void on_subscribe(Subscriber) const {
    }
};

}

/*! @copydoc rx-never.hpp
 */
template<class T>
auto never()
    ->      observable<T, detail::never<T>> {
    return  observable<T, detail::never<T>>(detail::never<T>());
}

}

}

#endif