test_has_get_pointer.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright (c) 2005 Daniel Wallin
  2. // Permission is hereby granted, free of charge, to any person obtaining a
  3. // copy of this software and associated documentation files (the "Software"),
  4. // to deal in the Software without restriction, including without limitation
  5. // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  6. // and/or sell copies of the Software, and to permit persons to whom the
  7. // Software is furnished to do so, subject to the following conditions:
  8. // The above copyright notice and this permission notice shall be included
  9. // in all copies or substantial portions of the Software.
  10. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
  11. // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  12. // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  13. // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
  14. // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
  15. // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  16. // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
  18. // OR OTHER DEALINGS IN THE SOFTWARE.
  19. #include <luabind/detail/has_get_pointer.hpp>
  20. #include <boost/mpl/assert.hpp>
  21. #include <boost/shared_ptr.hpp>
  22. #include <boost/get_pointer.hpp>
  23. #include <boost/enable_shared_from_this.hpp>
  24. namespace lb = luabind::detail;
  25. namespace test
  26. {
  27. struct X
  28. {
  29. };
  30. struct Y
  31. {
  32. };
  33. Y* get_pointer(Y const&);
  34. struct Z : boost::enable_shared_from_this<Z> {};
  35. } // namespace test
  36. #ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
  37. namespace luabind
  38. {
  39. using test::get_pointer;
  40. using boost::get_pointer;
  41. } // namespace luabind
  42. #endif
  43. BOOST_MPL_ASSERT(( lb::has_get_pointer<boost::shared_ptr<int> > ));
  44. BOOST_MPL_ASSERT(( lb::has_get_pointer<test::Y> ));
  45. BOOST_MPL_ASSERT(( lb::has_get_pointer<char*> ));
  46. BOOST_MPL_ASSERT_NOT(( lb::has_get_pointer<int> ));
  47. BOOST_MPL_ASSERT_NOT(( lb::has_get_pointer<test::X> ));
  48. BOOST_MPL_ASSERT(( lb::has_get_pointer<test::Z*> ));