lib_y.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef BOOST_CONTRACT_TEST_LIB_Y_HPP_
  2. #define BOOST_CONTRACT_TEST_LIB_Y_HPP_
  3. // Copyright (C) 2008-2018 Lorenzo Caminiti
  4. // Distributed under the Boost Software License, Version 1.0 (see accompanying
  5. // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
  6. // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
  7. #include "lib_x.hpp"
  8. #include <boost/contract.hpp> // All headers so test ODR for entire lib.
  9. #include <boost/config.hpp>
  10. #ifdef BOOST_CONTRACT_TEST_LIB_Y_DYN_LINK
  11. #ifdef BOOST_CONTRACT_TEST_LIB_Y_SOURCE
  12. #define BOOST_CONTRACT_TEST_LIB_Y_DECLSPEC BOOST_SYMBOL_EXPORT
  13. #else
  14. #define BOOST_CONTRACT_TEST_LIB_Y_DECLSPEC BOOST_SYMBOL_IMPORT
  15. #endif
  16. #else
  17. #define BOOST_CONTRACT_TEST_LIB_Y_DECLSPEC /* nothing */
  18. #endif
  19. namespace lib_y_ { // Internal namepsace.
  20. void BOOST_CONTRACT_TEST_LIB_Y_DECLSPEC y_body();
  21. }
  22. inline void y() {
  23. using boost::contract::test::detail::out;
  24. boost::contract::check c = boost::contract::function()
  25. // Capturing [&] so out() visible in MSVC10 lambdas.
  26. .precondition([&] { out("y::pre\n"); })
  27. .old([&] { out("y::old\n"); })
  28. .postcondition([&] { out("y::post\n"); })
  29. ;
  30. lib_y_::y_body();
  31. }
  32. #endif