force_instantiate.hpp 873 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright David Abrahams 2002.
  2. // Distributed under the Boost Software License, Version 1.0. (See
  3. // accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef FORCE_INSTANTIATE_DWA200265_HPP
  6. # define FORCE_INSTANTIATE_DWA200265_HPP
  7. namespace boost { namespace python { namespace detail {
  8. // Allows us to force the argument to be instantiated without
  9. // incurring unused variable warnings
  10. # if !defined(BOOST_MSVC) || BOOST_MSVC < 1300 || _MSC_FULL_VER > 13102196
  11. template <class T>
  12. inline void force_instantiate(T const&) {}
  13. # else
  14. # pragma optimize("g", off)
  15. inline void force_instantiate_impl(...) {}
  16. # pragma optimize("", on)
  17. template <class T>
  18. inline void force_instantiate(T const& x)
  19. {
  20. detail::force_instantiate_impl(&x);
  21. }
  22. # endif
  23. }}} // namespace boost::python::detail
  24. #endif // FORCE_INSTANTIATE_DWA200265_HPP