base_from_member_ref_test.cpp 596 B

1234567891011121314151617181920212223242526272829
  1. //
  2. // Test that a base_from_member<T&> can be properly constructed
  3. //
  4. // Copyright 2014 Agustin Berge
  5. //
  6. // Distributed under the Boost Software License, Version 1.0.
  7. // See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt
  9. //
  10. #include <boost/utility/base_from_member.hpp>
  11. #include <boost/core/lightweight_test.hpp>
  12. struct foo : boost::base_from_member<int&>
  13. {
  14. explicit foo(int& ref) : boost::base_from_member<int&>(ref)
  15. {
  16. BOOST_TEST(&member == &ref);
  17. }
  18. };
  19. int main()
  20. {
  21. int i = 0;
  22. foo f(i);
  23. return boost::report_errors();
  24. }