bastring.h: Move exception stuff after definition of string.
* std/bastring.h: Move exception stuff after definition of string. Move typedef of string here. * string: From here. From-SVN: r15832
This commit is contained in:
parent
15039abedc
commit
b6aa195e20
|
@ -1,3 +1,9 @@
|
||||||
|
Thu Oct 2 00:08:18 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||||
|
|
||||||
|
* std/bastring.h: Move exception stuff after definition of string.
|
||||||
|
Move typedef of string here.
|
||||||
|
* string: From here.
|
||||||
|
|
||||||
Sat Sep 27 16:48:00 1997 Jason Merrill <jason@yorick.cygnus.com>
|
Sat Sep 27 16:48:00 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||||
|
|
||||||
* std/complext.h: Lose injection decls.
|
* std/complext.h: Lose injection decls.
|
||||||
|
|
|
@ -35,22 +35,6 @@
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <std/straits.h>
|
#include <std/straits.h>
|
||||||
|
|
||||||
#ifdef __STL_USE_EXCEPTIONS
|
|
||||||
|
|
||||||
#include <stdexcept>
|
|
||||||
#define OUTOFRANGE(cond) \
|
|
||||||
do { if (!(cond)) throw out_of_range (#cond); } while (0)
|
|
||||||
#define LENGTHERROR(cond) \
|
|
||||||
do { if (!(cond)) throw length_error (#cond); } while (0)
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#define OUTOFRANGE(cond) assert (!(cond))
|
|
||||||
#define LENGTHERROR(cond) assert (!(cond))
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern "C++" {
|
extern "C++" {
|
||||||
class istream; class ostream;
|
class istream; class ostream;
|
||||||
|
|
||||||
|
@ -278,16 +262,8 @@ public:
|
||||||
reference operator[] (size_type pos)
|
reference operator[] (size_type pos)
|
||||||
{ unique (); return (*rep ())[pos]; }
|
{ unique (); return (*rep ())[pos]; }
|
||||||
|
|
||||||
reference at (size_type pos)
|
inline reference at (size_type pos);
|
||||||
{
|
inline const_reference at (size_type pos) const;
|
||||||
OUTOFRANGE (pos >= length ());
|
|
||||||
return (*this)[pos];
|
|
||||||
}
|
|
||||||
const_reference at (size_type pos) const
|
|
||||||
{
|
|
||||||
OUTOFRANGE (pos >= length ());
|
|
||||||
return data ()[pos];
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void terminate () const
|
void terminate () const
|
||||||
|
@ -383,6 +359,41 @@ private:
|
||||||
charT *dat;
|
charT *dat;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef basic_string <char> string;
|
||||||
|
// typedef basic_string <wchar_t> wstring;
|
||||||
|
|
||||||
|
#ifdef __STL_USE_EXCEPTIONS
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
#define OUTOFRANGE(cond) \
|
||||||
|
do { if (!(cond)) throw out_of_range (#cond); } while (0)
|
||||||
|
#define LENGTHERROR(cond) \
|
||||||
|
do { if (!(cond)) throw length_error (#cond); } while (0)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#define OUTOFRANGE(cond) assert (!(cond))
|
||||||
|
#define LENGTHERROR(cond) assert (!(cond))
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <class charT, class traits>
|
||||||
|
inline basic_string <charT, traits>::reference
|
||||||
|
basic_string <charT, traits>::at (size_type pos)
|
||||||
|
{
|
||||||
|
OUTOFRANGE (pos >= length ());
|
||||||
|
return (*this)[pos];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class charT, class traits>
|
||||||
|
inline basic_string <charT, traits>::const_reference
|
||||||
|
basic_string <charT, traits>::at (size_type pos) const
|
||||||
|
{
|
||||||
|
OUTOFRANGE (pos >= length ());
|
||||||
|
return data ()[pos];
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __STL_MEMBER_TEMPLATES
|
#ifdef __STL_MEMBER_TEMPLATES
|
||||||
template <class charT, class traits> template <class InputIterator>
|
template <class charT, class traits> template <class InputIterator>
|
||||||
basic_string <charT, traits>& basic_string <charT, traits>::
|
basic_string <charT, traits>& basic_string <charT, traits>::
|
||||||
|
|
|
@ -5,9 +5,4 @@
|
||||||
|
|
||||||
#include <std/bastring.h>
|
#include <std/bastring.h>
|
||||||
|
|
||||||
extern "C++" {
|
|
||||||
typedef basic_string <char> string;
|
|
||||||
// typedef basic_string <wchar_t> wstring;
|
|
||||||
} // extern "C++"
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue