boost_no_cxx11_std_align.ipp 856 B

12345678910111213141516171819202122232425262728293031323334
  1. // (C) Copyright John Maddock 2012
  2. // (C) Copyright Peter Dimov 2014
  3. // Use, modification and distribution are subject to the
  4. // Boost Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. // See http://www.boost.org/libs/config for more information.
  7. // MACRO: BOOST_NO_CXX11_STD_ALIGN
  8. // TITLE: C++11 <memory> doesn't have a working std::align
  9. // DESCRIPTION: The compiler does not support the function std::align added to <memory>
  10. #include <memory>
  11. namespace boost_no_cxx11_std_align {
  12. int test()
  13. {
  14. char buffer[ 32 ];
  15. void * ptr = buffer + 1;
  16. std::size_t space = sizeof( buffer ) - 1;
  17. void * p2 = std::align( 4, 2, ptr, space );
  18. if( p2 == 0 ) return 1;
  19. if( p2 != ptr ) return 1;
  20. if( (size_t)p2 % 4 ) return 1;
  21. return 0;
  22. }
  23. }