Impl Add for type alias tuple (f64, f64)

前端 未结 1 510
小鲜肉
小鲜肉 2021-01-28 18:25

I have a custom type Point

type Point = (f64, f64);

And I want to add two Points together but I get this error

err         


        
相关标签:
1条回答
  • 2021-01-28 19:07

    No, you don't have a Point type. The type keyword unfortunately does not create a new type, but only a new name (alias) for an existing type.

    To create a type, use:

    struct Point(f64, f64);
    
    0 讨论(0)
提交回复
热议问题