Menu

Vec<T> issue

2005-10-06
2012-09-15
  • Kripps Asirvatham

    Hi,

    I have a class defined as follows
    class A
    {
    A()
    ~A();
    .
    .
    .
    }

    And I use a vector of class A as below

    Vec<A> objectA;

    But when I use the set_size function (explicitly or implicitly) "objectA.set_size(N);"
    I get a compile time error
    it++\include\base\vec.h(520): error C2440: 'type cast' : cannot convert from 'int' to 'A'

    Any pointers will be helpful.

    Thanks,
    Kripps/-

     
    • Andy Panov

      Andy Panov - 2005-10-06

      Hi,

      Your class should provide a constructor in form:
      A(int) in order to work with Vec properly, since Vec<Num_T>
      uses Num_T(0) to initialize empty elements of vector.

      Andy

       

Log in to post a comment.