.at()


R. Clayton (rclayton@clayton.cs.monmouth.edu)
(no date)


The .at() member function for vectors seems to be working properly all over
the place:

  cs uname -a
  SunOS cslab18 5.8 Generic_108528-07 sun4u sparc

  cs date
  Fri Feb 8 11:16:51 EST 2002

  cs cat t.cc
  #include <vector>
  #include <iostream>

  int main() {

    std::vector<int> ivec;

    ivec.push_back(-1);

    try { ivec.at(0) = 1; }
    catch (...) {
      std::cerr << "exception thrown by \"ivec.at(0) = 1;\".\n";
      }

    try { ivec.at(1) = 1; }
    catch (...) {
      std::cerr << "exception thrown by \"ivec.at(1) = 1;\".\n";
      }
    }

  cs g++ -o t -ansi -pedantic -Wall t.cc

  cs ./t
  exception thrown by "ivec.at(1) = 1;".

  cs CC -o t t.cc

  cs ./t
  exception thrown by "ivec.at(1) = 1;".

  cs rsh rockhopper
  Last login: Fri Feb 8 11:12:30 from cslab18.cs.monmouth.edu

  ro uname -a
  Linux rockhopper.monmouth.edu 2.4.17 #1 SMP Thu Jan 3 13:52:42 EST 2002 i686 unknown

  ro g++ -o t -ansi -pedantic -Wall t.cc

  ro ./t
  exception thrown by "ivec.at(1) = 1;".

  ro rsh moncol

  mo uname -a
  OSF1 moncol.MONMOUTH.EDU V5.1 732 alpha

  mo cxx -o t t.cc

  mo ./t
  exception thrown by "ivec.at(1) = 1;".

  mo

If you get different behavior, send me the code, how you compiled it, and what
happened when you ran your code. If the only information you give me is "It
didn't work on linux," the only thing I can do is say "Gee, that's too bad."



This archive was generated by hypermail 2.0b3 on Fri May 10 2002 - 12:45:04 EDT