ios_base是一个名称空间吗?如何能查到它是在哪里定义的?
----------------------------------------------------------------------------
看到代码中有这样一句:
using std::ios_base;我不明白,ios_base是名称空间呢?还是一个成员函数呢?
我如何能查到呢?我想找到一种方法,遇到这类问题如何查,总不能只会用呀,我想进一步了解,它是在哪里定义的呀!!

解决方案 »

  1.   

    不是,应该是个类名,std空间中的一个类,是标准库中所有I/O类的基类。
      

  2.   

    我想找到它是在哪里定义的,哪个头文件或是cpp文件中,有对它的声明或定义呢?
      

  3.   

    // ios standard header#if     _MSC_VER > 1000 /*IFSTRIP=IGN*/
    #pragma once
    #endif#ifndef _IOS_
    #define _IOS_
    #include <streambuf>#ifdef  _MSC_VER
    #pragma pack(push,8)
    #endif  /* _MSC_VER */
    _STD_BEGIN
    // TEMPLATE CLASS basic_ios
    template<class _E, class _Tr = char_traits<_E> >
    class basic_ios : public ios_base {
    public:
    typedef basic_ios<_E, _Tr> _Myt;
    typedef basic_ostream<_E, _Tr> _Myos;
    typedef basic_streambuf<_E, _Tr> _Mysb;
    typedef ctype<_E> _Ctype;
    explicit basic_ios(_Mysb *_S)
    {init(_S); }
    basic_ios(const _Myt& _R)
    {init(0), *this = _R; }
    virtual ~basic_ios()ios文件中,有base_ios类的声明,但是ios_base是base_ios的基类呀。
    如何找到ios_base类的声明呢?
      

  4.   

    template<class _E, class _Tr = char_traits<_E> >
        class basic_ios : public ios_base {
    -----------------------------
    这说明 ios_base 是 basic_ios的基类,我想问,这个基类在哪里定义的呢?
      

  5.   

    是不是在这里啊..
    d:\Program Files\Microsoft Visual Studio\VC98\Include\XIOSBASEclass _CRTIMP ios_base {
    public:
                            // CLASS failure
            class failure : public runtime_error {
            public:
                    explicit failure(const string &_S)
                            : runtime_error(_S) {}
                    virtual ~failure()
                            {}
            protected:
                    virtual void _Doraise() const
                            {_RAISE(*this); }
            };
            enum _Fmtflags {skipws = 0x0001, unitbuf = 0x0002,
                    uppercase = 0x0004, showbase = 0x0008,
                    showpoint = 0x0010, showpos = 0x0020,
                    left = 0x0040, right = 0x0080, internal = 0x0100,
                    dec = 0x0200, oct = 0x0400, hex = 0x0800,
                    scientific = 0x1000, fixed = 0x2000, boolalpha = 0x4000,
                    adjustfield = 0x01c0, basefield = 0x0e00,
                    floatfield = 0x3000, _Fmtmask = 0x7fff, _Fmtzero = 0};
            enum _Iostate {goodbit = 0x0, eofbit = 0x1,
                    failbit = 0x2, badbit = 0x4, _Statmask = 0x7};
            enum _Openmode {in = 0x01, out = 0x02, ate = 0x04,
                    app = 0x08, trunc = 0x10, binary = 0x20};
            enum seekdir {beg = 0, cur = 1, end = 2};
            enum event {erase_event, imbue_event, copyfmt_event};
            typedef void (__cdecl *event_callback)(event, ios_base&, int);
            _BITMASK(_Fmtflags, fmtflags);
            _BITMASK(_Iostate, iostate);
            _BITMASK(_Openmode, openmode);
            typedef short io_state, open_mode, seek_dir;
                            // CLASS Init
            class _CRTIMP Init {
            public:
                    Init();
                    ~Init();
            private:
                    static int _Init_cnt;
                    };
            ios_base& operator=(const ios_base& _R)
                    {if (this != &_R)
                            {_State = _R._State;
                            copyfmt(_R); }
          ..........................
      

  6.   

    在ios_base上点右键,选择转到定义,就可以打开ios_base的代码了
      

  7.   

    谢谢,您是如何找到的呀,能告我方法吗?
    另外,ios文件中,没有引用这个文件呀,但是却可以直接用 ios_base,如:
    public ios_base,这是为什么呢?
    一般要包含一下才能用呀,但是ios中没有包含XIOSBASE,却可以用 public ios_base ,这是为什么呢?