@@ -671,6 +671,7 @@ where
671671
672672macro_rules! arith_scalar_func {
673673 ( $rust_type: ty, $op_name: ident, $fn_name: ident) => {
674+ // Implement (&Array<T> op_name rust_type)
674675 impl <' f, T > $op_name<$rust_type> for & ' f Array <T >
675676 where
676677 T : HasAfEnum + ImplicitPromote <$rust_type>,
@@ -685,6 +686,7 @@ macro_rules! arith_scalar_func {
685686 }
686687 }
687688
689+ // Implement (Array<T> op_name rust_type)
688690 impl <T : HasAfEnum > $op_name<$rust_type> for Array <T >
689691 where
690692 T : HasAfEnum + ImplicitPromote <$rust_type>,
@@ -698,6 +700,34 @@ macro_rules! arith_scalar_func {
698700 $fn_name( & self , & temp, false )
699701 }
700702 }
703+
704+ // Implement (rust_type op_name &Array<T>)
705+ impl <' f, T > $op_name<& ' f Array <T >> for $rust_type
706+ where
707+ T : HasAfEnum + ImplicitPromote <$rust_type>,
708+ $rust_type: HasAfEnum + ImplicitPromote <T >,
709+ <$rust_type as ImplicitPromote <T >>:: Output : HasAfEnum ,
710+ {
711+ type Output = Array <<$rust_type as ImplicitPromote <T >>:: Output >;
712+
713+ fn $fn_name( self , rhs: & ' f Array <T >) -> Self :: Output {
714+ $fn_name( & self , rhs, false )
715+ }
716+ }
717+
718+ // Implement (rust_type op_name Array<T>)
719+ impl <T > $op_name<Array <T >> for $rust_type
720+ where
721+ T : HasAfEnum + ImplicitPromote <$rust_type>,
722+ $rust_type: HasAfEnum + ImplicitPromote <T >,
723+ <$rust_type as ImplicitPromote <T >>:: Output : HasAfEnum ,
724+ {
725+ type Output = Array <<$rust_type as ImplicitPromote <T >>:: Output >;
726+
727+ fn $fn_name( self , rhs: Array <T >) -> Self :: Output {
728+ $fn_name( & self , & rhs, false )
729+ }
730+ }
701731 } ;
702732}
703733
0 commit comments