Commit 8d9c4afe authored by Dominik Charousset's avatar Dominik Charousset

Merge branch 'master' into unstable

parents 6a65f5d0 6c498131
...@@ -12,6 +12,13 @@ __2014_XX_XX__ ...@@ -12,6 +12,13 @@ __2014_XX_XX__
* New header `system_messages.hpp` for message types used by the runtime * New header `system_messages.hpp` for message types used by the runtime
- Announce properly handles empty & POD types - Announce properly handles empty & POD types
Version 0.8.2
-------------
__2014-18-03__
- Fixed a compile-time error with some user-defined message types
Version 0.8.1 Version 0.8.1
------------- -------------
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <cstddef> #include <cstddef>
#include "cppa/util/type_traits.hpp" #include "cppa/util/type_traits.hpp"
#include "cppa/util/rebindable_reference.hpp"
namespace cppa { namespace cppa {
...@@ -90,8 +91,9 @@ inline auto get_ref(std::tuple<Ts...>& tup) -> decltype(std::get<Pos>(tup)) { ...@@ -90,8 +91,9 @@ inline auto get_ref(std::tuple<Ts...>& tup) -> decltype(std::get<Pos>(tup)) {
* depending on the cv-qualifier of @p tup. * depending on the cv-qualifier of @p tup.
*/ */
template<size_t Pos, class Tuple> template<size_t Pos, class Tuple>
inline auto get_cv_aware(Tuple& tup) -> decltype(get_ref<Pos>(tup)) { inline auto get_cv_aware(Tuple& tup)
return get_ref<Pos>(tup); -> decltype(util::unwrap_ref(get_ref<Pos>(tup))) {
return util::unwrap_ref(get_ref<Pos>(tup));
} }
/** /**
...@@ -99,8 +101,9 @@ inline auto get_cv_aware(Tuple& tup) -> decltype(get_ref<Pos>(tup)) { ...@@ -99,8 +101,9 @@ inline auto get_cv_aware(Tuple& tup) -> decltype(get_ref<Pos>(tup)) {
* depending on the cv-qualifier of @p tup. * depending on the cv-qualifier of @p tup.
*/ */
template<size_t Pos, class Tuple> template<size_t Pos, class Tuple>
inline auto get_cv_aware(const Tuple& tup) -> decltype(get<Pos>(tup)) { inline auto get_cv_aware(const Tuple& tup)
return get<Pos>(tup); -> decltype(util::unwrap_ref(get<Pos>(tup))) {
return util::unwrap_ref(get<Pos>(tup));
} }
} // namespace cppa } // namespace cppa
......
...@@ -114,6 +114,22 @@ class rebindable_reference { ...@@ -114,6 +114,22 @@ class rebindable_reference {
}; };
template<typename T>
T& unwrap_ref(T& ref) {
return ref;
}
template<typename T>
T& unwrap_ref(util::rebindable_reference<T>& ref) {
return ref.get();
}
template<typename T>
typename std::add_const<T>::type&
unwrap_ref(const util::rebindable_reference<T>& ref) {
return ref.get();
}
} } // namespace cppa::util } } // namespace cppa::util
#endif // CPPA_REBINDABLE_REFERENCE_HPP #endif // CPPA_REBINDABLE_REFERENCE_HPP
No preview for this file type
...@@ -7,7 +7,7 @@ using namespace cppa::placeholders; ...@@ -7,7 +7,7 @@ using namespace cppa::placeholders;
struct sync_mirror : sb_actor<sync_mirror> { struct sync_mirror : sb_actor<sync_mirror> {
behavior init_state; behavior init_state;
sync_mirror() { sync_mirror() {
init_state = ( init_state = (
others() >> [=] { return last_dequeued(); } others() >> [=] { return last_dequeued(); }
...@@ -167,6 +167,13 @@ struct server : event_based_actor { ...@@ -167,6 +167,13 @@ struct server : event_based_actor {
}; };
void compile_time_optional_variant_check(event_based_actor* self) {
typedef optional_variant<std::tuple<int, float>,
std::tuple<float, int, int>>
msg_type;
self->sync_send(self, atom("msg")).then([](msg_type) {});
}
void test_sync_send() { void test_sync_send() {
scoped_actor self; scoped_actor self;
self->on_sync_failure([&] { self->on_sync_failure([&] {
......
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