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 11 #include <boost/utility/base_from_member.hpp> 12 13 #include <boost/core/lightweight_test.hpp> 14 15 struct foo : boost::base_from_member<int&> 16 { foofoo17 explicit foo(int& ref) : boost::base_from_member<int&>(ref) 18 { 19 BOOST_TEST(&member == &ref); 20 } 21 }; 22 main()23int main() 24 { 25 int i = 0; 26 foo f(i); 27 28 return boost::report_errors(); 29 } 30