static_binding.hpp 831 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Boost.TypeErasure library
  2. //
  3. // Copyright 2011 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. #ifndef BOOST_TYPE_ERASURE_STATIC_BINDING_HPP_INCLUDED
  11. #define BOOST_TYPE_ERASURE_STATIC_BINDING_HPP_INCLUDED
  12. namespace boost {
  13. namespace type_erasure {
  14. /**
  15. * Represents a mapping from placeholders to the actual types
  16. * that they bind to.
  17. *
  18. * \pre @c Map must be an MPL map whose keys are placeholders.
  19. */
  20. template<class Map>
  21. struct static_binding { typedef Map map_type; };
  22. /**
  23. * A convenience function to prevent constructor calls
  24. * from being parsed as function declarations.
  25. */
  26. template<class Map>
  27. static_binding<Map> make_binding() { return static_binding<Map>(); }
  28. }
  29. }
  30. #endif