foreign.cc 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // -*- mode: c++; coding: utf-8 -*-
  2. /// @file foreign.cc
  3. /// @brief Regression for value_t, rank_s
  4. // (c) Daniel Llorens - 2020
  5. // This library is free software; you can redistribute it and/or modify it under
  6. // the terms of the GNU Lesser General Public License as published by the Free
  7. // Software Foundation; either version 3 of the License, or (at your option) any
  8. // later version.
  9. #include <iostream>
  10. #include <iterator>
  11. #include <numeric>
  12. #include "ra/test.hh"
  13. #include "ra/ra.hh"
  14. using std::cout, std::endl, std::flush, ra::TestRecorder;
  15. template <class C>
  16. struct bsphere
  17. {
  18. C c;
  19. };
  20. template <class C>
  21. double above(C const & p, bsphere<C> const & o)
  22. {
  23. return 0;
  24. }
  25. template <class B, class C>
  26. requires (0!=ra::rank_s<B>() && std::is_same_v<C, ra::value_t<B>>)
  27. double
  28. above(C const & p, B const & o)
  29. {
  30. return 1;
  31. }
  32. int main()
  33. {
  34. TestRecorder tr(cout);
  35. using P = ra::Small<double, 2>;
  36. tr.test_eq(0, above(P {1, 1}, bsphere<P> {{1, 2}}));
  37. tr.test_eq(1, above(P {1, 1}, ra::Small<P, 2> {{1, 2}, {3, 4}}));
  38. return tr.summary();
  39. }