23 static constexpr auto preferred_disposables_mode = rpp::details::observers::disposables_mode::Auto;
26 : m_state{std::make_shared<state>(copy_values)}
30 void on_next(
const Type& v)
const noexcept
32 ++m_state->m_on_next_const_ref_count;
33 if (m_state->m_copy_values)
34 m_state->vals.push_back(v);
37 void on_next(Type&& v)
const noexcept
39 ++m_state->m_on_next_move_count;
40 if (m_state->m_copy_values)
41 m_state->vals.push_back(std::move(v));
44 void on_error(
const std::exception_ptr&)
const noexcept { ++m_state->m_on_error_count; }
45 void on_completed()
const noexcept { ++m_state->m_on_completed_count; }
47 static bool is_disposed()
noexcept {
return false; }
50 size_t get_total_on_next_count()
const {
return m_state->m_on_next_const_ref_count + m_state->m_on_next_move_count; }
51 size_t get_on_next_const_ref_count()
const {
return m_state->m_on_next_const_ref_count; }
52 size_t get_on_next_move_count()
const {
return m_state->m_on_next_move_count; }
53 size_t get_on_error_count()
const {
return m_state->m_on_error_count; }
54 size_t get_on_completed_count()
const {
return m_state->m_on_completed_count; }
56 std::vector<Type> get_received_values()
const {
return m_state->vals; }
64 explicit state(
bool copy_values)
65 : m_copy_values{copy_values}
69 bool m_copy_values =
true;
70 size_t m_on_next_const_ref_count = 0;
71 size_t m_on_next_move_count = 0;
72 size_t m_on_error_count = 0;
73 size_t m_on_completed_count = 0;
75 std::vector<Type> vals{};
78 std::shared_ptr<state> m_state{};