Why not just use this, which works with any container using random access iterators, including plain old arrays. If you can use iteration instead of indexing, you can also opt out of the random access requirement.
template <typename Cnt1, typename Cnt2> void addData(const Cnt1& yData, Cnt2 xData)
C ++ 03 version (does not support plain old arrays):
template <typename Cnt1, typename Cnt2> void addData(const Cnt1& yData, Cnt2 xData)
source share