1. C++ / Говнокод #27271

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    // -------------------------------------------
    // 2.2. binary calls
    // -------------------------------------------
    /*
        combination table:
    
          +-   | c a n
            ---|-------
             c | C A N
             a | A A N
             n | N N N
    
          *    | c a n
            ---|-------
             c | C A N
             a | A N N
             n | N N N
    
          /    | c a n
            ---|-------
             c | C N N
             a | A N N
             n | N N N
    
        argument:
          c : constant, as scalar, point, tensor, ect
          l : affine homogeneous expr argument: as field, field_indirect or field_expr_node::is_affine_homogeneous
          n : function, functor or ! field_expr_node::is_affine_homogeneous
        result:
          C : constant : this combination is not implemented here
          A,N : are implemented here
        rules:
          at least one of the two args is not of type "c"
          when c: c value is embeded in bind_first or bind_second
                  and the operation reduces to an unary one
          when a: if it is a field_convertible, it should be wrapped
                  in field_expr_v2_nonlinear_terminal_field
          when c: no wrapper is need
        implementation:
          The a and n cases are grouped, thanks to the wrapper_traits
          and it remains to cases :
            1) both args are  field_expr_v2_nonlinear or a function 
            2) one  arg  is a field_expr_v2_nonlinear or a function and the second argument is a constant
    */
    
    #define _RHEOLEF_make_field_expr_v2_nonlinear_binary(FUNCTION,FUNCTOR)	\
    template<class Expr1, class Expr2>						\
    inline										\
    typename									\
    std::enable_if<									\
         details::is_field_expr_v2_nonlinear_arg<Expr1>::value			\
      && details::is_field_expr_v2_nonlinear_arg<Expr2>::value			\
      && ! details::is_field_expr_v2_constant   <Expr1>::value			\
      && ! details::is_field_expr_v2_constant   <Expr2>::value			\
     ,details::field_expr_v2_nonlinear_node_binary<					\
        FUNCTOR									\
       ,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type	\
       ,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr2>::type 	\
      >										\
    >::type										\
    FUNCTION (const Expr1& expr1, const Expr2& expr2)				\
    {										\
      typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type wrap1_t; \
      typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr2>::type wrap2_t; \
      return details::field_expr_v2_nonlinear_node_binary <FUNCTOR,wrap1_t,wrap2_t> \
    	(FUNCTOR(), wrap1_t(expr1), wrap2_t(expr2)); 				\
    }										\
    template<class Expr1, class Expr2>						\
    inline										\
    typename 									\
    std::enable_if<									\
         details::is_field_expr_v2_constant     <Expr1>::value			\
      && details::is_field_expr_v2_nonlinear_arg<Expr2>::value			\
      && ! details::is_field_expr_v2_constant   <Expr2>::value			\
     ,details::field_expr_v2_nonlinear_node_unary<					\
        details::binder_first<							\
          FUNCTOR									\
         ,typename details::field_promote_first_argument<				\
            Expr1

    Запостил: MAKAKA, 25 Февраля 2021

    Комментарии (19) RSS

    Добавить комментарий