"No matching Call Error"
Hi
Following code is giving compilation error in g++. #include<iostream> #include<vector> using namespace std; template<typename T> struct subvector_traits { typedef T* iterator; }; template<typename T> class subvector { public: typedef typename subvector_traits<T>::iterator iterator; void initialize(iterator start,iterator end) { m_pstart=start; m_pend=end; } private: iterator m_pstart; iterator m_pend; }; int main() { subvector<unsigned int> cells; static vector<unsigned int> m_nMembercells; cells.initialize(m_nMembercells.begin(),m_nMembercells.begin()); return 0; } Error Message:- > no matching function for call to `subvector<unsigned int>:: initialize(__gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > >, __gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > >)' initialize.cpp:20: candidates are: void subvector<T>::initialize(subvector_traits<T>::iterator, subvector_traits<T>::iterator) [with T = unsigned int] initialize.cpp:37:2: warning: no newline at end of file If anyone has some idea then please help Thanx in advance Ashwini :confused: |
That is some sweet code... sweetly broken that is. I am still learning C++, but I can tell you some things:
(1): I don't know what your doing with those typedefs, but it isn't healthy. (2): struct subvector_traits is an empty stucture. (3:) The usual reason the comiler would be giving that error is because you need to do some type-casting. Basically I am no help, so you shouldn't listen to me! :D |
All times are GMT -5. The time now is 09:01 AM. |