passing data of an object to a function that takes a different object

Discussion in 'C' started by aortizb, Sep 19, 2009.

  1. aortizb

    aortizb New Member

    Sep 12, 2008
    Likes Received:
    Trophy Points:

    Let's assume I have a "Vec" class which is a wrapper of std::vector. The only private variable of "Vec" is just a std::vector object.

    Let's assume that I have a function: void Vec:: foo(const Vec<double>& myVec).

    Now, let's assume that I have an object vector<double> vec(100,3.5). Suppose that the entries of "vec" are exactly the entries I need in "myVec". Is there any way I can pass the entries of "vec" to "foo" without copying all its entries to an object of "Vec class"?


Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice