20170326STL08_STL_SGI_config.h

config.h:

1:sgi是一个公司的简称,有一个操作系统是SGI unix?,商业化的,很难接触到。
2:前端部分是版权声明,说明了可以做什么,不可做什么。
3:下面一大段注释是解释了整个文档做的事。下面代码基本就没有注释了(这是一个比较老的习惯)。
4:SGISTL里面会来检测这与编译器相关的宏是否被定义,从而得出编译器是否支持这些特性,根据这些情况来控制代码,确保跨平台不出错。
// Flags:
// * __STL_NO_BOOL: defined if the compiler doesn't have bool as a builtin
	//编译器没有内部定义原生bool的时候就会定义宏   __STL_NO_BOOL
	//看编译器是否有定义bool(原生bool)


//   type.
// * __STL_HAS_WCHAR_T: defined if the compier has wchar_t as a builtin type.
	//_WCHAR_T_IS_KEYWORD 宏,看编译器内部是否有定义wchar_t,没有的时候就会定义这个宏
	//判断这些是否有定义有两种方式:1,看编译器是否有定义这些宏。2,通过编译器的版本直接判断


// * __STL_NO_DRAND48: defined if the compiler doesn't have the drand48 
//   function.
	//求随机数的。非C标准里面的函数,Linux下面会有


//一下的就是判断是否支持某些特性
// * __STL_STATIC_TEMPLATE_MEMBER_BUG: defined if the compiler can't handle
//   static members of template classes.
	//是否支持在模板类里面定义一个静态成员,不支持就定义这个宏
	//模板类里面如果定义静态成员,对编译器来说是个非常复杂的事情。


// * __STL_STATIC_CONST_INIT_BUG: defined if the compiler can't handle a
//   constant-initializer in the declaration of a static const data member
//   of integer type.  (See section 9.4.2, paragraph 4, of the C++ standard.)
	//static const 的这样的静态常量的定义。是否可以在类里面正常初始化
/*
class Demo
{
public:
	int a_ = 0;//是个非常危险的写法,不应该这样写,不能再类中初始化
	static int b_;//不可初始化
	static const int c_ = 10;//仅仅是int类型可以在类里面初始化
	static const double d_;//不可初始化
};
int Demo::b_ = 10;
double Demo::d_ = 2.5;
*/


// * __STL_CLASS_PARTIAL_SPECIALIZATION: defined if the compiler supports
//   partial specialization of template classes.
	//是否支持模板类的局部特化,基本每个编译器都会支持。


// * __STL_PARTIAL_SPECIALIZATION_SYNTAX: defined if the compiler 
//   supports partial specialization syntax for full specialization of
//   class templates.  (Even if it doesn't actually support partial 
//   specialization itself.)
	//是否支持类模板的部分排序,偏序实例化。在有重载和特化的情况下就会有偏序。
/*//偏序实例化:和推导相关
template
void Foo(T t)
{}
template
void Foo(T *t)//重载(所有指针类型)
{}
template//这些写法在很多比较老的编译器下是不被支持的。
void Foo(const T *t)
{}
template<>
void Foo(int *t)//这个特化应该是属于(T *t),是对他的特化,
{}*/


// * __STL_FUNCTION_TMPL_PARTIAL_ORDER: defined if the compiler supports
//   partial ordering of function templates.  (a.k.a partial specialization
//   of function templates.)
	//是否支持函数模板的部分排序,偏序实例化

// * __STL_MEMBER_TEMPLATES: defined if the compiler supports template
//   member functions of classes.
	//类模板里面支持模板函数,大部分编译器都支持
/*
template
class 
{
public:
	template
	void Foo(T t){}
protected:
};*/


// * __STL_MEMBER_TEMPLATE_CLASSES: defined if the compiler supports 
//   nested classes that are member templates of other classes.
	//是否支持一个模板类支持内嵌类为一个模板类。一般编译器都支持,甚至模板类都支持内部模板类
	//内嵌类就是内部类。
/*
class Demo
{
public:
	template
	class Demo1
	{
	T data_;
	public:
		Demo1(T t) :data_(t)
		{
		}
	};
	Demo1 data_;
protected:
	Demo(int data) :data_(data){}
};*/


// * __STL_TEMPLATE_FRIENDS: defined if the compiler supports templatized
//   friend declarations.
	//一个模板类是否可以为其他类的友元
	//一般的都支持,否则流运算符(<<>>)就无法重载了。

// * __STL_EXPLICIT_FUNCTION_TMPL_ARGS: defined if the compiler 
//   supports calling a function template by providing its template
//   arguments explicitly.
	//是否支持函数对模板参数的推导

// * __STL_LIMITED_DEFAULT_TEMPLATES: defined if the compiler is unable
//   to handle default template parameters that depend on previous template
//   parameters.
	//是否支持下面这种(前一个参数为后一个参数的默认值)
/*//几乎都支持
template >
class Demo
{
};*/

// * __STL_NON_TYPE_TMPL_PARAM_BUG: defined if the compiler has trouble with
//   function template argument deduction for non-type template parameters.
	//是否支持模板接收一个non type的一个参数,如下
/*//基本都只支持的
template
class Demo
{
public:
};*/



// * __SGI_STL_NO_ARROW_OPERATOR: defined if the compiler is unable
//   to support the -> operator for iterators.
	//是否支持迭代器里面重载->运算符,不支持则定义这个宏。

// * __STL_DEFAULT_CONSTRUCTOR_BUG: defined if T() does not work properly
//   when T is a builtin type.
	//不支持T(),定义这个宏,eg:printf("%d",int(10));,就是临时对象
	//是否支持默认类型 int->int(),char->char()。

// * __STL_USE_EXCEPTIONS: defined if the compiler (in the current compilation
//   mode) supports exceptions.
	//是否支持异常

// * __STL_USE_NAMESPACES: defined if the compiler has the necessary
//   support for namespaces.
	//是否支持命名空间

// * __STL_NO_EXCEPTION_HEADER: defined if the compiler does not have a
//   standard-conforming header .
	//是否有exception头文件,没有就定义这个宏


// * __STL_NO_BAD_ALLOC: defined if the compiler does not have a 
//   header, or if  does not contain a bad_alloc class.  If a bad_alloc
//   class exists, it is assumed to be in namespace std.
	//是否有头文件,或者里面没有bad_alloc类,就定义这个宏。(必须在std命名空间里面)


// * __STL_SGI_THREADS: defined if this is being compiled for an SGI IRIX
//   system in multithreaded mode, using native SGI threads instead of 
//   pthreads.
	//线程相关


// * __STL_WIN32THREADS: defined if this is being compiled on a WIN32
//   compiler in multithreaded mode.

// * __STL_PTHREADS: defined if we should use portable pthreads
//   synchronization.

// * __STL_UITHREADS: defined if we should use UI / solaris / UnixWare threads
//   synchronization.  UIthreads are similar to pthreads, but are based 
//   on an earlier version of the Posix threads standard.
	//以上都是线程相关的


// * __STL_LONG_LONG if the compiler has long long and unsigned long long
//   types.  (They're not in the C++ standard, but they are expected to be 
//   included in the forthcoming C9X standard.)
	//是否有long long 和 unsigned long long

// * __STL_THREADS is defined if thread safety is needed.
	//是否线程安全

// * __STL_VOLATILE is defined to be "volatile" if threads are being
//   used, and the empty string otherwise.
	//线程相关


// * __STL_USE_CONCEPT_CHECKS enables some extra compile-time error
//   checking to make sure that user-defined template arguments satisfy
//   all of the appropriate requirements.  This may result in more
//   comprehensible error messages.  It incurs no runtime overhead.  This 
//   feature requires member templates and partial specialization.
	//编译器选项:开了会进行错误检查……


// * __STL_NO_USING_CLAUSE_IN_CLASS: The compiler does not handle "using"
//   clauses inside of class definitions.
	//类定义中不能用using。不支持的话肯定是非主流编译器

// * __STL_NO_FRIEND_TEMPLATE_CLASS: The compiler does not handle friend
//   declaractions where the friend is a template class.
	//不支持模板类成为其他的友元

// * __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE: The compiler does not
//   support the use of a function pointer type as the argument
//   for a template.
	//不支持函数指针成为一个类模板参数
	//template,T不能为函数指针

// * __STL_MEMBER_TEMPLATE_KEYWORD: standard C++ requires the template
//   keyword in a few new places (14.2.4).  This flag is set for
//   compilers that support (and require) this usage.


// User-settable macros that control compilation:
	//用户自定义的
// * __STL_USE_SGI_ALLOCATORS: if defined, then the STL will use older
//   SGI-style allocators, instead of standard-conforming allocators,
//   even if the compiler supports all of the language features needed
//   for standard-conforming allocators.
	//被定义的话,会用老版本的sgi的alloc。

// * __STL_NO_NAMESPACES: if defined, don't put the library in namespace
//   std, even if the compiler supports namespaces.
	//将生成的library不加到namespace std中。


// * __STL_NO_RELOPS_NAMESPACE: if defined, don't put the relational
//   operator templates (>, <=. >=, !=) in namespace std::rel_ops, even
//   if the compiler supports namespaces and partial ordering of
//   function templates.
// * __STL_ASSERTIONS: if defined, then enable runtime checking through the
//   __stl_assert macro.
// * _PTHREADS: if defined, use Posix threads for multithreading support.
// * _UITHREADS:if defined, use SCO/Solaris/UI threads for multithreading 
//   support
// * _NOTHREADS: if defined, don't use any multithreading support.  
// * _STL_NO_CONCEPT_CHECKS: if defined, disables the error checking that
//   we get from __STL_USE_CONCEPT_CHECKS.
// * __STL_USE_NEW_IOSTREAMS: if defined, then the STL will use new,
//   standard-conforming iostreams (e.g. the  header).  If not
//   defined, the STL will use old cfront-style iostreams (e.g. the
//    header).

// Other macros defined by this file:

// * bool, true, and false, if __STL_NO_BOOL is defined.
// * typename, as a null macro if it's not already a keyword.
// * explicit, as a null macro if it's not already a keyword.
// * namespace-related macros (__STD, __STL_BEGIN_NAMESPACE, etc.)
// * exception-related macros (__STL_TRY, __STL_UNWIND, etc.)
// * __stl_assert, either as a test or as a null macro, depending on
//   whether or not __STL_ASSERTIONS is defined.

你可能感兴趣的:(Po,stl,sgi)