simple vector question

Benjamin Kosnik bkoz@redhat.com
Tue Dec 11 16:43:00 GMT 2001


I must be losing it...

#include <vector.h>

void test01()
{
  using namespace std;
  typedef int 	mask;
  typedef vector<mask> 		vector_type;

  const int max = 255;
  vector_type v_c[max];
  vector_type v_de[max];

  int i = 0;
  mask mask_test = static_cast<mask>(0);
  mask mask_is = static_cast<mask>(0);
  vector_type::reference m = v_c[i]; // 18
  // mask& m = v_c[i];
  m = mask_is;
}


int main()
{
  return 0;
}


Gives:

vec_tester.cc: In function `void test01 ()':
vec_tester.cc:18: cannot convert `vector<mask, allocator<mask> >' to 
`int' in converting


What does this mean? Is this correct? I'd expect

  vector_type::reference m = v_c[i]; // 18

to be

  vector_type::reference m = vector_type::reference; // 18

which is

  int&  m = int &; // 18


??

I must be missing something simple.

(And what's up with this error message?)

-benjamin



More information about the Libstdc++ mailing list