boost_no_restrict_references.ipp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // (C) Copyright Beman Dawes 2009
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/config for more information.
  6. // MACRO: BOOST_NO_RESTRICT_REFERENCES
  7. // TITLE: We cannot apply BOOST_RESTRICT to a reference type.
  8. // DESCRIPTION: We cannot apply BOOST_RESTRICT to a reference type
  9. #include <boost/config.hpp>
  10. namespace boost_no_restrict_references {
  11. #ifdef _MSC_VER
  12. #pragma warning(error:4227)
  13. #endif
  14. void sum2(int (& BOOST_RESTRICT a)[4], int (& BOOST_RESTRICT b)[4], int (&c)[4], int (&d)[4]) {
  15. int i;
  16. for (i = 0; i < 4; i++) {
  17. a[i] = b[i] + c[i];
  18. c[i] = b[i] + d[i];
  19. }
  20. }
  21. int test()
  22. {
  23. int a[4] = { 1, 2, 3, 4 };
  24. int b[4] = { 3, 4, 5, 6 };
  25. int c[4] = { 0, 1, 3, 5 };
  26. int d[4] = { 2, 4, 6, 8 };
  27. sum2(a, b, c, d);
  28. return 0;
  29. }
  30. #ifdef _MSC_VER
  31. #pragma warning(default:4227)
  32. #endif
  33. }