fail_add_temperature.cpp 839 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Boost.Units - A C++ library for zero-overhead dimensional analysis and
  2. // unit/quantity manipulation and conversion
  3. //
  4. // Copyright (C) 2003-2008 Matthias Christian Schabel
  5. // Copyright (C) 2008 Steven Watanabe
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See
  8. // accompanying file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. /**
  11. \file
  12. \brief fail_add_temperature.cpp
  13. \details
  14. Verify that adding two absolute temeratures fails miserably.
  15. Output:
  16. @verbatim
  17. @endverbatim
  18. **/
  19. #include <boost/units/quantity.hpp>
  20. #include <boost/units/absolute.hpp>
  21. #include <boost/units/systems/si/temperature.hpp>
  22. namespace bu = boost::units;
  23. int main(int,char *[])
  24. {
  25. bu::quantity<bu::absolute<bu::si::temperature> > q(2.0 * bu::absolute<bu::si::temperature>());
  26. q += q;
  27. return 0;
  28. }