fork(1) download
  1. #include <cmath>
  2. #include <iostream>
  3. #include <type_traits>
  4. #include <utility>
  5.  
  6. template <typename T>
  7. constexpr decltype(div(T{}, T{})) make_div(const T quot, const T rem)
  8. {
  9. decltype(div(T{}, T{})) x{};
  10. x.quot = quot;
  11. x.rem = rem;
  12. return x;
  13. }
  14.  
  15. int main() {
  16. std::cout << make_div(2,1).quot;
  17. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
2