| 1 | // Boost.TypeErasure library |
| 2 | // |
| 3 | // Copyright 2015 Steven Watanabe |
| 4 | // |
| 5 | // Distributed under the Boost Software License Version 1.0. (See |
| 6 | // accompanying file LICENSE_1_0.txt or copy at |
| 7 | // http://www.boost.org/LICENSE_1_0.txt) |
| 8 | // |
| 9 | // $Id$ |
| 10 | |
| 11 | #ifndef BOOST_TYPE_ERASURE_DYNAMIC_BINDING_HPP_INCLUDED |
| 12 | #define BOOST_TYPE_ERASURE_DYNAMIC_BINDING_HPP_INCLUDED |
| 13 | |
| 14 | #include <boost/type_erasure/detail/dynamic_vtable.hpp> |
| 15 | #include <boost/type_erasure/static_binding.hpp> |
| 16 | |
| 17 | namespace boost { |
| 18 | namespace type_erasure { |
| 19 | |
| 20 | /** |
| 21 | * Maps a set of placeholders to actual types. |
| 22 | */ |
| 23 | template<class PlaceholderList> |
| 24 | class dynamic_binding |
| 25 | { |
| 26 | public: |
| 27 | template<class Map> |
| 28 | dynamic_binding(const static_binding<Map>&) |
| 29 | { |
| 30 | impl.template init<Map>(); |
| 31 | } |
| 32 | template<class Concept, class Map> |
| 33 | dynamic_binding(const binding<Concept>& other, const static_binding<Map>&) |
| 34 | { |
| 35 | impl.template convert_from<Map>(*other.impl.table); |
| 36 | } |
| 37 | private: |
| 38 | template<class Concept> |
| 39 | friend class binding; |
| 40 | typename ::boost::type_erasure::detail::make_dynamic_vtable<PlaceholderList>::type impl; |
| 41 | }; |
| 42 | |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | #endif |
| 47 | |