foreign.cc 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 <numeric>
  10. #include <iostream>
  11. #include <iterator>
  12. #include "ra/test.hh"
  13. using std::cout, std::endl, std::flush, ra::TestRecorder;
  14. template <class C>
  15. struct bsphere
  16. {
  17. C c;
  18. };
  19. template <class C>
  20. double above(C const & p, bsphere<C> const & o)
  21. {
  22. return 0;
  23. }
  24. template <class B, class C>
  25. requires (0!=ra::rank_s<B>() && std::is_same_v<C, ra::value_t<B>>)
  26. double
  27. above(C const & p, B const & o)
  28. {
  29. return 1;
  30. }
  31. int main()
  32. {
  33. TestRecorder tr(cout);
  34. using P = ra::Small<double, 2>;
  35. tr.test_eq(0, above(P {1, 1}, bsphere<P> {{1, 2}}));
  36. tr.test_eq(1, above(P {1, 1}, ra::Small<P, 2> {{1, 2}, {3, 4}}));
  37. return tr.summary();
  38. }