This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

help with vector code



This program gives:

// libstdc++/4456, libstdc++/4457, libstdc++/4458

#include <vector>

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);
#if 1
  vector_type::reference m = v_c[i];
  // mask& m = v_c[i];
  m = mask_is;
#else
  v_c[i] = mask_is;
#endif
}


int main()
{
  return 0;
}


gives:
vec_tester.cc: In function `void test01()':
vec_tester.cc:18: cannot convert `void test01()::vector_type' to `int'
in 
   converting


Ok, first of all, what's up with the error message here? Is it
truncated?

Second of all, isn't it vector_type::reference converting to same? What
am I missing here? I suspect it's simple, and I'm sorry for bugging
y'all.

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

Ack!

-benjamin




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]