CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: laserlight

Search: Search took 0.11 seconds.

  1. Replies
    26
    Views
    20,834

    Re: matrix multiplication

    When the Matrix object is const, or when you are accessing the Matrix object through a const reference or a pointer to a const Matrix.
  2. Replies
    26
    Views
    20,834

    Re: matrix multiplication

    Yeah, though it may be better to have the const version return a const reference.
  3. Replies
    26
    Views
    20,834

    Re: matrix multiplication

    Notice that there are two versions of operator().
  4. Replies
    26
    Views
    20,834

    Re: matrix multiplication

    It sounds like you need to const overload operator(), i.e.,

    float& Matrix::operator()(const int nRow, const int nCol)
    {
    return m_pfMatrix[nRow * m_nColCount + nCol];
    }

    const float&...
  5. Replies
    26
    Views
    20,834

    Re: matrix multiplication

    Your copy constructor and copy assignment operator should have the parameter as const Matrix&. After all, it should make sense to copy a matrix that is constant.

    I notice that the copy assignment...
  6. Replies
    26
    Views
    20,834

    Re: matrix multiplication

    That does not really make sense. The destructor will not normally be called from the constructor.

    On a hunch: did you implement the copy constructor and copy assignment operator?
Results 1 to 6 of 6





Click Here to Expand Forum to Full Width

Featured