operator_seq.cpp 812 B

1234567891011121314151617181920212223242526272829
  1. // Copyright (C) 2009-2012 Lorenzo Caminiti
  2. // Distributed under the Boost Software License, Version 1.0
  3. // (see accompanying file LICENSE_1_0.txt or a copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // Home at http://www.boost.org/libs/local_function
  6. #include <boost/local_function.hpp>
  7. #include <boost/typeof/typeof.hpp>
  8. #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
  9. #include <boost/detail/lightweight_test.hpp>
  10. struct point {
  11. int x;
  12. int y;
  13. };
  14. BOOST_TYPEOF_REGISTER_TYPE(point) // Register for `NAME` below.
  15. int main(void) {
  16. bool BOOST_LOCAL_FUNCTION( (const point& p) (const point& q) ) {
  17. return p.x == q.x && p.y == q.y;
  18. } BOOST_LOCAL_FUNCTION_NAME(equal)
  19. point a; a.x = 1; a.y = 2;
  20. point b = a;
  21. BOOST_TEST(equal(a, b));
  22. return boost::report_errors();
  23. }