is_acceptable.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* Copyright 2016-2017 Joaquin M Lopez Munoz.
  2. * Distributed under the Boost Software License, Version 1.0.
  3. * (See accompanying file LICENSE_1_0.txt or copy at
  4. * http://www.boost.org/LICENSE_1_0.txt)
  5. *
  6. * See http://www.boost.org/libs/poly_collection for library home page.
  7. */
  8. #ifndef BOOST_POLY_COLLECTION_DETAIL_IS_ACCEPTABLE_HPP
  9. #define BOOST_POLY_COLLECTION_DETAIL_IS_ACCEPTABLE_HPP
  10. #if defined(_MSC_VER)
  11. #pragma once
  12. #endif
  13. #include <type_traits>
  14. namespace boost{
  15. namespace poly_collection{
  16. namespace detail{
  17. /* This can be further specialized by Model when the std type trait classes
  18. * fail to give the right info (as it can happen with class templates whose
  19. * nominally existing operators do not compile for certain instantiations).
  20. */
  21. template<typename T,typename Model,typename=void>
  22. struct is_acceptable:std::integral_constant<
  23. bool,
  24. Model::template is_implementation<T>::value&&
  25. std::is_move_constructible<typename std::decay<T>::type>::value&&
  26. (std::is_move_assignable<typename std::decay<T>::type>::value||
  27. std::is_nothrow_move_constructible<typename std::decay<T>::type>::value)
  28. >{};
  29. } /* namespace poly_collection::detail */
  30. } /* namespace poly_collection */
  31. } /* namespace boost */
  32. #endif