Commit 0a1da9b7 authored by Dominik Charousset's avatar Dominik Charousset

Add convenience constant invalid_stream

parent 208596dc
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2018 Dominik Charousset *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_INVALID_STREAM_HPP
#define CAF_INVALID_STREAM_HPP
#include "caf/detail/type_traits.hpp"
namespace caf {
struct invalid_stream_t {};
constexpr invalid_stream_t invalid_stream = invalid_stream_t{};
} // namespace caf
#endif // CAF_INVALID_STREAM_HPP
......@@ -23,6 +23,7 @@
#include "caf/make_source_result.hpp"
#include "caf/make_stage_result.hpp"
#include "caf/stream_slot.hpp"
#include "caf/invalid_stream.hpp"
#include "caf/meta/type_name.hpp"
......@@ -44,6 +45,10 @@ public:
output_stream(const output_stream&) = default;
output_stream(invalid_stream_t) : in_(0), out_(0) {
// nop
}
template <class S>
output_stream(make_source_result<T, S, Ts...> x)
: in_(0),
......
......@@ -20,6 +20,7 @@
#define CAF_STREAM_HPP
#include "caf/fwd.hpp"
#include "caf/invalid_stream.hpp"
#include "caf/stream_manager.hpp"
#include "caf/stream_slot.hpp"
......@@ -43,12 +44,14 @@ public:
stream& operator=(stream&&) = default;
stream& operator=(const stream&) = default;
/// Convenience constructor for returning the result of `self->new_stream`
/// and similar functions.
explicit stream(stream_slot id = 0) : slot_(id) {
// nop
}
explicit stream(invalid_stream_t) : slot_(0) {
// nop
}
// -- properties -------------------------------------------------------------
/// Returns the actor-specific stream slot ID.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment