#ifndef ARRAY_OPERATION #define ARRAY_OPERATION #include namespace opt_utilities { /////////Useful function/////////////////////////////////// template inline size_t get_size(const T& x) { return x.size(); } template class element_type_trait { public: typedef typename T::value_type element_type; }; template class return_type_trait { public: typedef T value_type; typedef T& reference_type; typedef const T& const_reference_type; }; template inline typename return_type_trait::element_type>:: const_reference_type get_element(const T& x,size_t i) { return x[i]; } /* template inline typename element_type_trait::element_type& get_element(T& x,size_t i) { return x[i]; } */ template inline void set_element(T& x,size_t i, const TX& v) { x[i]=v; } template inline void resize(T& x,size_t s) { x.resize(s); } template inline Tl& opt_eq(Tl& lhs,const Tr& rhs) { return (lhs=rhs); } } #endif