SHARE
TWEET

Untitled

a guest Sep 19th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. #include <tuple>
  4.  
  5. #include "Operation.hpp"
  6.  
  7. template <typename... Args>
  8. class Input {
  9. public:
  10.     using args = Op::pack<Args...>;
  11.     std::tuple<Args...> args_;
  12.  
  13.     Input(Args... args): args_(args...) {};
  14. };
  15.  
  16. template <typename T, typename U>
  17. class Output {
  18. public:
  19.     typedef T T1;
  20.     typedef U T2;
  21.  
  22.     T t_;
  23.     U u_;
  24.  
  25.     Output(T t, U u): t_(t), u_(u) {}
  26. };
  27.  
  28.  
  29. class Add: Op::Operation<Input<int, double, int>, Output<int, int>> {
  30. public:
  31.     int result;
  32.  
  33.     Add(input_t in, output_t out) {
  34.         result =
  35.             std::get<0>(in.args_) +
  36.             std::get<1>(in.args_) +
  37.             std::get<2>(in.args_) +
  38.             out.t_ +
  39.             out.u_;
  40.     }
  41.  
  42. };
  43.  
  44. int main() {
  45.     Input<int, double, int> i(1, 1.0, 1);
  46.     Output<int, int> o(1, 0);
  47.  
  48.     auto add = Add(i, o);
  49.     std::cout << "Added to " << add.result << "\n";
  50.     return 0;
  51. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top