   Just a warning I got from visual studio
  I am confused on why I am getting this warning. This is the code.template<class OP>void SquareMatrix::_applyToMatrix(const SquareMatrix& mat){std::transform( m_array, m_array + size(), mat.m_array , mat.m_array + mat.size(),OP());}The warning I got was :warning C4996: 'std::transform': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. I get what its saying, but here in this situation. The OP passed in is somethinglike std::plus<Type> or something similar. So if not, the function would notcompile. Thus I am not seeing why I am getting that error, unless there issome class OP, that would pass the compile stage, but cause some sort ofassertion when used in _applyToMatrix() function. Maybe I'm not seeing something. Anyone wanna care to explain?Also, the name SquareMatrix, should suggest that m_array and mat.m_arraywill always be the same size, because this private function will be calledfrom a public one, in which that assertion will needs to be passed before thecall to this function.   
  That's just Microsoft's compiler trying to help you hurt yourself.  They marked a bunch of functions from the standard libraries as unsafe.  They then provided alternate functions that verify correctness rather than assume the programmer knows what they are doing.  If you are on Windows only, it generally won't hurt to know about and use them.You can read the MSDN page about their "Safe Libraries".You can turn the warnings off, see the bottom of that page.   ;  It looks like you think std transform takes two iterator ranges.This is not correct.If we look at the documentation, there are two versions of this function:template<class InputIterator, class OutputIterator, class UnaryFunction>   OutputIterator transform( InputIterator _First1,  InputIterator _Last1,  OutputIterator _Result, UnaryFunction _Func );template<class InputIterator1, class InputIterator2, class OutputIterator,   class BinaryFunction>   OutputIterator transform( InputIterator1 _First1,  InputIterator1 _Last1, InputIterator2 _First2,  OutputIterator _Result, BinaryFunction _Func   );Your call compiles down to the second.Transform applies OP() size() times (_Last1-_First1).Since mat.m_array is used for _First2, if mat.m_array does not contain at least this->size() elements, you have a buffer overrun.Since mat.m_array + mat.size() us used for _Result (not _Last2!), you have a buffer overrun if mat.m_array does not contain at least this->size() + mat.size() elements!This is what your compiler is trying to warn you about.  To fix and protect your code, you would do something like:void SquareMatrix::_applyToMatrix(const SquareMatrix& mat){assert( size() == mat.size() ); // Throw up an error in debug mode if the sizes aren't equalstd::transform( m_array, m_array + size(), mat.m_array, mat.m_array, OP());}Or (probably less of a good idea in this case, but relevant in others, and probably what you thought transform would do by itself):void SquareMatrix::_applyToMatrix(const SquareMatrix& mat){size_t smaller = std::min( size(), mat.size() );std::transform( m_array, m_array + smaller, mat.m_array, mat.m_array, OP());};  Um... also, you're using a const SquareMatrix& for the output. That can't be right.The idea is to end up with a matrix that represents A <op> B, where <op> is some kind of operation on matrices applied element-by-element, yeah?Well, first off, that's not a very useful thing to generalize, because there are extremely few operations that make sense to apply element-by-element to "square matrices of any size". In fact, I would say that addition is really the only such operation.Second, why should you have to have an existing matrix to write into? Why not create a new result?And third, how is it that 'm_array' is an iterator rather than the storage itself? Did you seriously store an iterator as a data member? Don't do that. It's asking for a world of pain (bugs). Create iterators on demand. Please.Even if you keep this templated, you probably want something more like:template <typename OP>SquareMatrix applied_elementwise(const SquareMatrix& a, const SquareMatrix& b) {  assert(a.size() == b.size());  SquareMatrix result(a.size()); // initial element count  std::transform(a.begin(), a.end(), b.begin(), result.begin(), OP());  return result;}