Home | History | Annotate | Download | only in sources
      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_NEVER_HPP)
      6 #define RXCPP_SOURCES_RX_NEVER_HPP
      7 
      8 #include "../rx-includes.hpp"
      9 
     10 /*! \file rx-never.hpp
     11 
     12     \brief Returns an observable that never sends any items or notifications to observer.
     13 
     14     \tparam T  the type of (not) emitted items
     15 
     16     \return  Observable that never sends any items or notifications to observer.
     17 
     18     \sample
     19     \snippet never.cpp never sample
     20     \snippet output.txt never sample
     21 */
     22 
     23 namespace rxcpp {
     24 
     25 namespace sources {
     26 
     27 namespace detail {
     28 
     29 template<class T>
     30 struct never : public source_base<T>
     31 {
     32     template<class Subscriber>
     33     void on_subscribe(Subscriber) const {
     34     }
     35 };
     36 
     37 }
     38 
     39 /*! @copydoc rx-never.hpp
     40  */
     41 template<class T>
     42 auto never()
     43     ->      observable<T, detail::never<T>> {
     44     return  observable<T, detail::never<T>>(detail::never<T>());
     45 }
     46 
     47 }
     48 
     49 }
     50 
     51 #endif
     52