STL source code analysis-stl_config.h

Source: Internet
Author: User
// Filename: stl_config.h // comment by: Cream // E-mail: mdl2009@vip.qq.com // blog: http://blog.csdn.net/mdl13412/** copyright (c) 1996-1997 * Silicon Graphics Computer Systems, Inc. ** permission to use, copy, modify, distribute and merge this software * and its documentation for any purpose is hereby granted without tables, * provided that the above copyright notice appear in all copies and * that both That copyright notice and this permission notice appear * in supporting documentation. silicon Graphics makes no * representations about the suitability of this software for any * purpose. it is provided "as is" without express or implied warranty. * // * Note: This is an internal header file, encoded ded by other STL headers. * You shoshould not attempt to use it directly. */# ifndef _ stl_config_h # Defin E _ stl_config_h // configuration file menu: // (1) if no compiler defines bool, true, false, then define // (2) if the compiler does not support drand48 () the function defines _ stl_no_drand48 // Note: drand48 generates double-precision pseudo-random numbers. Because the 48-bit calculation is used, the name drand48 // (3) if the compiler does not support static members of template classes (static members of the template class), // DEFINE _ stl_static_template_member_bug // (4) if the compiler does not support the 'typename' keyword, define 'typename' as null (null macro) // (5) if the compiler supports partial specialization of class templates (templates class is special), // DEFINE _ stl_class_parti Al_specialization // reference: http://msdn.microsoft.com/en-us/library/9w7t3kf1 (V = vs.71 ). aspx // (6) If the compiler supports Partial Ordering of function templates (template function specific priority), // DEFINE _ stl_function_tmpl_partial_order // reference: http://msdn.microsoft.com/zh-cn/library/zaycz069.aspx// (7) if the compiler supports calling a function template by providing its template // arguments explicitly (explicitly specifying the template parameters for calling the template function) // DEFINE _ stl_explicit_function_tmpl_args/ /(8) if the compiler supports template members of classes (class template members), // DEFINE _ stl_member_templates // (9) If the compiler does not support the 'explicit' keyword, define 'explicit' as null (null macro) // (10) If the compiler cannot set the following default template parameters based on the previous template parameters, // DEFINE _ stl_limited_default_templates // (11) If the compiler is difficult to deduce the non-type template parameter type of the template function, define _ stl_non_type_tmpl_param_bug/(12) if the compiler does not support the iterator using the '->' operator, // defines _ sgi_stl_no_arrow_operator // (13). If the compiler (in the current compilation mode) supports exceptions, // DEFINE _ stl_use_exceptions // (14) If we put STL into the namespace, // defines _ stl_use_namespaces // (15) if the STL is compiled on the SGI compiler, the user does not select pthreads or no threads. // The _ stl_sgi_threads is used by default. // Note: POSIX thread is short for pthread, and POSIX thread is a POSIX standard thread. // (16) if the STL is compiled in multi-thread mode on the Win32 platform compiler, // DEFINE _ stl_win32threads // (17) appropriately define namespaces related macros (_ STD, _ stl_begin_namespace, etc.) // (18) appropriately define the macros related to exceptions (_ stl_try, _ stl_unwind, etc.) // (19) define _ stl_assertions as asserted or empty based on whether to define _ stl_assert (null Macro) # ifdef _ pthreads # DEFINE _ stl_pthreads # endif // If the compiler does not provide the functions required by this STL, define _ stl_need_xxx # If defined (_ SGI) &&! Defined (_ gnuc _) # If! Defined (_ bool) # DEFINE _ stl_need_bool # endif # If! Defined (_ typename_is_keyword) # DEFINE _ parameters # endif # ifdef _ parameters # DEFINE _ parameters # endif # ifdef _ member_templates # DEFINE _ stl_member_templates # endif # If! Defined (_ explicit_is_keyword) # DEFINE _ tions # endif # ifdef _ exceptions # DEFINE _ stl_use_exceptions # endif # If (_ compiler_version> = 721) & defined (_ namespaces) # DEFINE _ stl_use_namespaces # endif # If! Defined (_ nothreads )&&! Defined (_ stl_pthreads) # DEFINE _ stl_sgi_threads # endif # ifdef _ gnuc __# include <_ g_config.h> # If _ gnuc _ <2 | (_ gnuc _ = 2 & _ gnuc_minor _ <8) # DEFINE _ DEFINE # DEFINE _ stl_need_typename # DEFINE _ stl_need_explicit # else # DEFINE _ stl_class_partial_specialization # DEFINE _ DEFINE # DEFINE __ Stl_member_templates # endif/* glibc pre 2.0 is very buggy. We have to disable thread for it. It shoshould be upgraded to glibc 2.0 or later. */# If! Defined (_ nothreads) & _ glibc _> = 2 & defined (_ g_using_thunks) # DEFINE _ stl_pthreads # endif # ifdef _ exceptions # DEFINE _ stl_use_exceptions # endif // Sun C ++ compiler # If defined (_ sunpro_cc) # DEFINE _ stl_need_bool # DEFINE _ stl_need_typename # DEFINE _ stl_need_explicit # DEFINE _ stl_use_exceptions # endif // todo: I have not found any information, if you know or have relevant information, please contact me, thank u # If defined (_ como _) # DEFINE _ stl_me Mber_templates # DEFINE _ limits # DEFINE _ stl_use_tions # DEFINE _ stl_use_namespaces # endif // _ msc_ver defines Microsoft compiler versions // ms vc ++ 10.0 _ msc_ver = 1600 // ms vc + + 9.0 _ msc_ver = 1500 // ms vc + + 8.0 _ msc_ver = 1400 // ms vc + + 7.1 _ msc_ver = 1310 // ms vc + + 7.0 _ msc_ver = 1300 // ms vc ++ 6.0 _ msc_ver = 1200 // ms vc ++ 5.0 _ msc_ver = 1100 # If defined (_ msc_ver) # If _ msc_ver> 1000 # I Nclude <yvals. h> # else # DEFINE _ stl_need_bool # endif # DEFINE _ stl_no_drand48 # DEFINE _ else # If _ msc_ver <1100 # DEFINE _ stl_need_explicit # endif # DEFINE _ else # define _ Conditions # ifdef _ cppunwind # DEFINE _ stl_use_tions # endif # ifdef _ Mt # DEFINE _ stl_win32threads # endif # If defined (_ BorlandC __) # DEFINE _ stl_no_drand48 # define _ Stl_need_typename # DEFINE _ items # ifdef _ cppunwind # DEFINE _ stl_use_exceptions # endif # ifdef _ Mt __# DEFINE _ stl_win32threads # endif # If defined (_ stl_need_bool) typedef int bool; # define true 1 # define false 0 # endif # ifdef _ stl_need_typename # define typename # endif # ifdef _ stl_need_ex Plicit # Define explicit # endif # ifdef _ parameters # DEFINE _ stl_null_tmpl_args <> # else # DEFINE _ parameters # endif # ifdef _ parameters # DEFINE _ stl_template_null template <> # else # DEFINE _ stl_template_null # endif/_ stl_no_namespaces is a hook so that users can disable namespaces // without having to edit library headers. # If defined (_ stl_use _ Namespaces )&&! Defined (_ stl_no_namespaces) # DEFINE _ STD # DEFINE _ stl_begin_namespace STD {# DEFINE _ stl_end_namespace} # DEFINE _ extension # DEFINE _ inclunamespace STD {# DEFINE _ stl_end_relops_namespace }# define _ std_relops STD # else # DEFINE _ STD # DEFINE _ stl_begin_namespace # DEFINE _ stl_end_namespace # UNDEF _ stl_use_namespace_for_relops # define _ DEFINE # DEFINE _ stl_end_relops_namespace # DEFINE _ std_relops # endif # ifdef _ stl_use_exceptions # DEFINE _ stl_try try # DEFINE _ stl_catch_all catch (...) # DEFINE _ stl_rethrow throw # DEFINE _ stl_nothrow throw () # DEFINE _ stl_unwind (Action) catch (...) {action; throw ;}# else # DEFINE _ stl_try # DEFINE _ stl_catch_all if (false) # DEFINE _ stl_rethrow # DEFINE _ stl_nothrow # de Fine _ stl_unwind (Action) # endif # ifdef _ stl_assertions # include <stdio. h> # DEFINE _ stl_assert (expr) \ If (! (Expr) {fprintf (stderr, "% s: % d STL assertion failure: % s \ n", \ _ file __, _ line __, # expr ); abort () ;}# else # DEFINE _ stl_assert (expr) # endif/* _ stl_config_h * // local variables: // mode: c ++ // end:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.