Commit 74c0c86c authored by Dominik Charousset's avatar Dominik Charousset

moved tuple_dummy to its own header

parent 047214d5
......@@ -67,6 +67,7 @@ cppa/detail/sync_request_bouncer.hpp
cppa/detail/tdata.hpp
cppa/detail/to_uniform_name.hpp
cppa/detail/tuple_cast_impl.hpp
cppa/detail/tuple_dummy.hpp
cppa/detail/tuple_iterator.hpp
cppa/detail/tuple_vals.hpp
cppa/detail/tuple_view.hpp
......
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011-2013 *
* Dominik Charousset <dominik.charousset@haw-hamburg.de> *
* *
* This file is part of libcppa. *
* libcppa is free software: you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, *
* or (at your option) any later version. *
* *
* libcppa is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with libcppa. If not, see <http://www.gnu.org/licenses/>. *
\******************************************************************************/
#ifndef CPPA_DETAIL_TUPLE_DUMMY_HPP
#define CPPA_DETAIL_TUPLE_DUMMY_HPP
#include <typeinfo>
#include "cppa/util/type_list.hpp"
#include "cppa/detail/tuple_iterator.hpp"
namespace cppa {
namespace detail {
struct tuple_dummy {
typedef util::empty_type_list types;
typedef detail::tuple_iterator<tuple_dummy> const_iterator;
inline size_t size() const {
return 0;
}
inline void* mutable_at(size_t) {
return nullptr;
}
inline const void* at(size_t) const {
return nullptr;
}
inline const uniform_type_info* type_at(size_t) const {
return nullptr;
}
inline const std::type_info* type_token() const {
return &typeid(util::empty_type_list);
}
inline bool dynamically_typed() const {
return false;
}
inline const_iterator begin() const {
return {this};
}
inline const_iterator end() const {
return {this, 0};
}
};
} // namespace detail
} // namespace cppa
#endif // CPPA_DETAIL_TUPLE_DUMMY_HPP
......@@ -47,6 +47,7 @@
#include "cppa/detail/matches.hpp"
#include "cppa/detail/projection.hpp"
#include "cppa/detail/value_guard.hpp"
#include "cppa/detail/tuple_dummy.hpp"
#include "cppa/detail/pseudo_tuple.hpp"
#include "cppa/detail/behavior_impl.hpp"
......@@ -829,35 +830,7 @@ class match_expr {
template<class Tuple>
result_type apply(Tuple& tup) {
if (tup.empty()) {
struct tuple_dummy {
typedef util::empty_type_list types;
typedef detail::tuple_iterator<tuple_dummy> const_iterator;
inline size_t size() const {
return 0;
}
inline void* mutable_at(size_t) {
return nullptr;
}
inline const void* at(size_t) const {
return nullptr;
}
inline const uniform_type_info* type_at(size_t) const {
return nullptr;
}
inline const std::type_info* type_token() const {
return &typeid(util::empty_type_list);
}
inline bool dynamically_typed() const {
return false;
}
inline const_iterator begin() const {
return {this};
}
inline const_iterator end() const {
return {this, 0};
}
};
tuple_dummy td;
detail::tuple_dummy td;
auto td_token_ptr = td.type_token();
auto td_bitmask = get_cache_entry(td_token_ptr, td);
return detail::unroll_expr<result_type>(m_cases,
......
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