Can std::begin work with array parameters and if so, how?

后端 未结 5 2176
慢半拍i
慢半拍i 2020-12-03 02:08

I have trouble using std::begin() and std::end() (from the iterator library) with c-style array parameters.

void SetOr         


        
5条回答
  •  执笔经年
    2020-12-03 02:30

    void SetOrigin(const double i_point[3])
    

    is as same as

    void SetOrigin(const double i_point[])
    

    or

    void SetOrigin(const double *i_point)
    

    So, std::begin and std::end can not accept it. In C++ you can not pass an array but as a pointer or reference. If it's a pointer then it doesn't carry any information of passed array.

    Your alternatives are std::vector or std::array.

提交回复
热议问题