diff --git a/inc/pikg_vector.hpp b/inc/pikg_vector.hpp index d514ea7..be82da9 100644 --- a/inc/pikg_vector.hpp +++ b/inc/pikg_vector.hpp @@ -116,20 +116,14 @@ namespace PIKG{ } const T & operator[](const int i) const { + assert(i>=0 && i<3); if(0==i) return x; if(1==i) return y; - if(2==i) return z; - std::cout<<"PS_ERROR: Vector invalid access. \n"<<"function: "<<__FUNCTION__<<", line: "<<__LINE__<<", file: "<<__FILE__<=0 && i<3); if(0==i) return x; if(1==i) return y; return z; @@ -282,10 +276,12 @@ namespace PIKG{ } T& operator[](const int i){ + assert(i>=0 && i<2); if(0==i) return x; return y; } const T & operator[](const int i) const { + assert(i>=0 && i<2); if(0==i) return x; return y; }