亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tour-stdcxx.html

?? 大數運算類
?? HTML
?? 第 1 頁 / 共 2 頁
字號:
<html>
<head>
<title>
A Tour of NTL: Traditional and ISO Modes  </title>
</head>

<body bgcolor="#fff9e6">
<center>
<a href="tour-modules.html"><img src="arrow1.gif" alt="[Previous]" align=bottom></a>
 <a href="tour.html"><img src="arrow2.gif" alt="[Up]" align=bottom></a> 
<a href="tour-unix.html"> <img src="arrow3.gif" alt="[Next]" align=bottom></a>
</center>

<h1> 
<p align=center>
A Tour of NTL: Traditional and ISO Modes
</p>
</h1>

<p> <hr> <p>

<p>

As of version 4.1,
NTL can be compiled and used in one of two modes: Traditional or ISO.
To get ISO mode, you can pass <tt>NTL_STD_CXX=on</tt>
as an argument to the configuration script
when <a href="tour-unix.html">installing NTL on a Unix or Unix-like system</a>.
This will set the flag <tt>NTL_STD_CXX</tt> in the <tt>config.h</tt>
file.
Alternatively (and especially on non-Unix systems),
you can set this flag  by hand by editing 
the the <tt>config.h</tt> file.
<p>

Traditional mode provides the same interface as that provided 
in versions 4.0 and earlier.
Traditional mode is also the default, so old programs that used NTL
should continue to work without any changes.
So if you wish, you can completely ignore the new ISO mode, and ignore
the rest of this page.
However, if you want to fully exploit some important,
new features of <tt>C++</tt>, in particular <i>namespaces</i>, read on.
Also, it is likely that in future distributions of NTL, ISO mode will become
the default mode, although Traditional mode will continue to
be supported indefinitely.

<p>
In Traditional mode, the NTL header files include the traditional
<tt>C++</tt> header files <tt>&lt;stdlib.h&gt;</tt>,
<tt>&lt;math.h&gt;</tt>, and <tt>&lt;iostream.h&gt;</tt>.
These files declare a number of names (functions, types, etc.)
in the <i>global namespace</i>.
Additionally, the NTL header files declare a number of names,
also in the global namespace.

<p>
In ISO mode, three things change:

<ol>
<li>
<b>NTL namespace:</b>
The NTL header files wrap all NTL names in a namespace, called <tt>NTL</tt>.

<p>
<li>
<b>New header files:</b>
The NTL header files include the new <tt>C++</tt> 
header files <tt>&lt;cstdlib&gt;</tt>,
<tt>&lt;cmath&gt;</tt>, and <tt>&lt;iostream&gt;</tt>.
These new header files are essentially the same as the traditional ones,
except that all the the names are declared in a namespace called 
<tt>std</tt>.

<p>
<li>
<b>Nothrow new:</b>
The NTL implementation files use the <tt>nothrow</tt> version of <tt>new</tt>.
</ol>


<p>
ISO mode uses <tt>C++</tt> features that are new to
the new ISO <tt>C++</tt> standard.
I know of no compiler that truly implements all of the standard,
but some come pretty close.
If your complier is too old, you will not be able to use NTL in ISO 
mode;  otherwise, you are free to use either ISO or Traditional mode,
but I would recommend ISO mode for code that you expect to
be around for a long time.
In particular, if you want to develop and distribute a library that
builds on top of NTL, it would be preferable to make it compatible
with NTL in ISO mode, and even better, to make it compatible with
either mode.

<p>
If your complier is not up to date, but you want some of the benefits
of Standard <tt>C++</tt>, you can set the <i>partial standard</i>
flags to get any subset of the above three changes:
<p>
<ol>
<li>
<tt>NTL_PSTD_NNS</tt>: NTL namespace
<li>
<tt>NTL_PSTD_NHF</tt>: New header files
<li>
<tt>NTL_PSTD_NTN</tt>: Nothrow new
</ol>

You can set these flags either by using the configuration script
(only on Unix-like systems), or by editing the <tt>config.h</tt> file.
For example, to just wrap NTL in a namepsace, just pass 
<tt>NTL_PSTD_NNS=on</tt>
as an argument to the configuration script
when installing NTL.

<p>

Especially when combining NTL with other libraries, the
<tt>NTL_PSTD_NNS</tt> flag may be particularly useful
in avoiding name clashes, even if your compiler has just a
rudimentary implementation of namespaces.

<p>
NTL will remain usable in Traditional mode indefinitely,
assuming compilers maintain reasonable backward compatibilty with 
pre-standard <tt>C++</tt> conventions for header files;
however, if you want to <i>program for the future</i>, it is recommended
to use ISO mode.
The partial ISO modes are not highly recommended;
they are mainly intended as a stop-gap measure 
while we wait for decent standard-conforming <tt>C++</tt>
compilers to become available.


<p>
<h3>
A crash course on namespaces
</h3>

<p>
As already mentioned, the main difference between Traditional and ISO
mode is that in ISO mode, all names are wrapped in namespaces.
Namespaces are a feature that was introduced in the new <tt>C++</tt> standard.
One can declare names (functions, types, etc.) inside a namespace.
By default,
such names are not visible outside the namespace without explicit
qualification.

<p>
The main advantage of namespaces is that it solves the <i>namespace pollution
problem</i>:
if two libraries define the same name in two inconsistent ways,
it is very difficult, if not impossible,
to combine these two libraries in the same 
program.

<p>
The traditional way of avoiding such problems in languages like
<tt>C</tt> is for a library designer to attach a prefix specific
to that library to all names.
This works, but makes for ugly code.
The function overloading mechanism in <tt>C++</tt> eases the problem a bit,
but is still not a complete solution.

<p>

The new
namespace feature in <tt>C++</tt>
provides a reasonably complete and elegant solution to the namespace
pollution problem.
It is one of the nicest and most important recent additions to the <tt>C++</tt>
language.

<p>

Here is a simple example to illustrate namespaces.
<p>
<pre>

namespace N {
   void f(int);
   void g(int);
   int x;
}

int x;

void h()
{
   x = 1;    // the global x
   N::x = 0; // the x in namespace N
   N::f(0);  // the f in namespace N
   g(1);     // error -- g is not visible here
}

</pre>

<p>
All of this explicit qualification business
can be a bit tedious.
The easiest way to avoid this tedium is to use what is called
a <i>using directive</i>, which effectively makes
all names declared within a namespace visible in the
global scope.

Here is a variation on the previous example, with a using directive.

<p>
<pre>

namespace N {
   void f(int);
   void g(int);
   int x;
}

int x;

using namespace N;

void h()
{
   x = 1;    // error -- ambiguous: the global x or the x in namespace N?
   ::x = 1;  // the global x
   N::x = 0; // the x in namespace N
   N::f(0);  // the f in namespace N
   f(0);     // OK -- N::f(int) is visible here
   g(1);     // OK -- N::g(int) is visible here
}

</pre>

<p>
Here is another example.

<p>
<pre>

namespace N1 {
   int x;
   void f(int);
   void g(int);
}

namespace N2 {
   int x;
   int y;
   void f(double);
   void g(int);
}

using namespace N1;
using namespace N2;

void h()
{
   x = 1;     // error -- ambiguous: N1::x or N2::x?
   N1::x = 1; // OK
   N2::x = 1; // OK
   y = 1;     // OK  -- this is N2::y
   g(0);      // error -- ambiguous: N1::g(int) or N2::g(int)?
   f(0);      // OK -- N1::f(int), because it is the "best" match 
   f(0.0);    // OK  -- N2::f(double), because it is the "best" match
}

</pre>

<p>
This example illustrates the interaction between using declarations
and function overloading resolution.
If several overloaded versions of a function are visible,
it is not necessarily ambiguous: the usual overload resolution
procedure is applied, and if there is a unique "best" match,
then there is no ambiguity.

<p>

The examples presented here do not illustrate all of the
features and nuances of namespaces.
For this, you are referred to a <tt>C++</tt> book.

<p>
<h3>
Namespaces and NTL
</h3>

<p>
In ISO mode, the standard library is "wrapped" in namespace <tt>std</tt>,
and NTL is "wrapped" in namespace <tt>NTL</tt>.
Thus, the header file <tt>&lt;NTL/ZZ.h&gt;</tt> in ISO mode looks
something like this:
<pre>

namespace NTL {

   // ...

   class ZZ { /* ... */ };

   // ...

   ZZ operator+(const ZZ&amp; a, const ZZ&amp; b);
   ZZ operator*(const ZZ&amp; a, const ZZ&amp; b);

   std::istream&amp; operator>>(std::istream&amp; s, ZZ&amp; x);
   std::ostream&amp; operator<<(std::ostream&amp; s, const ZZ&amp; a);

   // ...

  
}

</pre>

Therefore, one must explicitly qualify all names, or use appropriate
using directives.
Here is how one could write the <a href="tour-ex1.html">first example</a> 
of the tour in
ISO mode.

<pre>

#include &lt;NTL/ZZ.h&gt;

int main()
{
   NTL::ZZ a, b, c; 

   std::cin &gt;&gt; a; 
   std::cin &gt;&gt; b; 
   c = (a+1)*(b+1);
   std::cout &lt;&lt; c &lt;&lt; "\n";
}

</pre>

<p>
Notice how everything is explicitly qualified.
Actually, the input/output operators <tt>&lt;&lt;</tt> and <tt>&gt;&gt;</tt>,
and the arithmetic operators <tt>+</tt> and <tt>*</tt> are not explicitly
qualified, but rather, the compiler finds them through a gimmick
called <i>Koenig Lookup</i>, which will look for functions (and operators)
declared in namespace <tt>NTL</tt>, because the type of the argument
(<tt>ZZ</tt>) is a class declared in that namespace.

<p>

Even with Koenig Lookup, explicit qualification can
be a bit tedious.
Here is the same example, this time with using directives.

<pre>

#include &lt;NTL/ZZ.h&gt;

using namespace NTL;
using namespace std;

int main()

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩你懂的电影在线观看| 欧美激情综合五月色丁香小说| 日本一区二区成人| 成人av中文字幕| 亚洲精品国产第一综合99久久| 欧美三级午夜理伦三级中视频| 丝袜亚洲另类丝袜在线| 精品国产一区二区三区不卡 | 美女在线视频一区| 精品日韩成人av| 成人av资源站| 亚洲电影中文字幕在线观看| 欧美一区二区在线看| 国产伦理精品不卡| 亚洲欧洲日产国码二区| 欧美午夜精品一区二区蜜桃| 麻豆一区二区三| 国产精品日产欧美久久久久| 在线免费不卡视频| 男人操女人的视频在线观看欧美| 精品国产亚洲在线| 99久久er热在这里只有精品15| 亚洲国产中文字幕在线视频综合 | 亚洲欧洲美洲综合色网| 91国产精品成人| 日韩在线观看一区二区| 久久精品日产第一区二区三区高清版| av在线不卡电影| 午夜影院在线观看欧美| 国产亚洲午夜高清国产拍精品| 91网站视频在线观看| 秋霞午夜av一区二区三区| 亚洲国产成人自拍| 欧美日韩一区成人| 国产精品18久久久久久久久久久久 | 亚洲精品国产视频| 日韩欧美成人一区二区| 99久久er热在这里只有精品15| 日韩成人午夜电影| 中文字幕一区二区5566日韩| 欧美一级搡bbbb搡bbbb| 99天天综合性| 麻豆精品蜜桃视频网站| 成人免费一区二区三区视频 | 97精品国产97久久久久久久久久久久| 亚洲国产精品久久久男人的天堂| 久久精品亚洲国产奇米99| 欧美日韩一区久久| 国产99久久久国产精品免费看| 午夜精品久久久久久| 国产精品沙发午睡系列990531| 欧美精品精品一区| av不卡在线观看| 精品无码三级在线观看视频| 亚洲精品国产成人久久av盗摄| 久久久久久久久久久99999| 欧美午夜宅男影院| 国产成人精品亚洲午夜麻豆| 日韩av网站在线观看| 亚洲乱码国产乱码精品精的特点 | 国产精品综合一区二区| 亚洲不卡一区二区三区| 国产精品高潮呻吟| 精品黑人一区二区三区久久| 欧美午夜精品一区二区蜜桃| 成人ar影院免费观看视频| 玖玖九九国产精品| 亚洲国产三级在线| 《视频一区视频二区| 久久久久国产一区二区三区四区| 欧美日韩高清影院| 日本高清免费不卡视频| 白白色 亚洲乱淫| 国产一区二区在线看| 视频一区视频二区中文字幕| 亚洲精品高清在线| 中文字幕一区二区三区在线不卡| 欧美精品一区二区三区很污很色的| 欧美日韩一区二区不卡| 91久久人澡人人添人人爽欧美| 成人一区二区视频| 国产老女人精品毛片久久| 免费日本视频一区| 亚洲成av人片观看| 亚洲国产综合色| 亚洲综合一区在线| 亚洲视频电影在线| 日韩一区在线看| 国产精品久久久久久久裸模| 国产婷婷一区二区| 久久久不卡网国产精品二区| 精品国产乱码久久久久久蜜臀| 欧美精品乱码久久久久久按摩| 一本大道久久a久久精品综合| www.综合网.com| 成人av在线资源网站| 国产婷婷一区二区| 成人午夜激情片| 亚洲日本va在线观看| 精品国产a毛片| 91蜜桃在线观看| www.久久精品| 成人黄色综合网站| 国产精品77777竹菊影视小说| 蜜桃免费网站一区二区三区| 另类小说图片综合网| 看片网站欧美日韩| 久草这里只有精品视频| 国内精品视频一区二区三区八戒| 老司机午夜精品| 精品影视av免费| 国产在线播放一区二区三区| 国产一区二区三区国产| 国产精品一级片在线观看| 国产剧情一区二区三区| 国产一区激情在线| 成人久久18免费网站麻豆 | 成人一区二区三区在线观看| 成人一区在线看| 99久久综合狠狠综合久久| 91啪九色porn原创视频在线观看| 色呦呦一区二区三区| 欧美性猛交xxxxxx富婆| 欧美一区二区网站| 欧美不卡123| 久久精品欧美日韩| 国产精品第五页| 一区二区三区鲁丝不卡| 午夜视频一区二区三区| 免费观看在线综合色| 国产精品综合网| 91色乱码一区二区三区| 欧美日韩国产综合草草| 在线视频中文字幕一区二区| 99精品视频在线观看| 久久www免费人成看片高清| 久久精品噜噜噜成人av农村| 国产精品99久久不卡二区| 99精品国产热久久91蜜凸| 欧美性色黄大片| 欧美一区二区三区在线观看视频 | 亚洲精品一区二区三区在线观看 | 国产成人精品综合在线观看| 97se亚洲国产综合在线| 欧美色手机在线观看| 日韩欧美一二三| 国产欧美一区视频| 亚洲精品成人在线| 日本视频中文字幕一区二区三区| 国产一区91精品张津瑜| 91论坛在线播放| 欧美日韩国产另类一区| 久久一区二区视频| 亚洲精品中文字幕乱码三区| 免费看欧美女人艹b| 成人永久aaa| 4438x成人网最大色成网站| 久久影视一区二区| 亚洲一区二区三区影院| 久久99久久精品| 91麻豆国产福利在线观看| 日韩午夜激情电影| 国产精品免费av| 日韩中文字幕区一区有砖一区 | 国产精品久久久久久福利一牛影视| 亚洲一区二区三区中文字幕| 韩国毛片一区二区三区| 色婷婷综合久久久中文字幕| 日韩精品中文字幕一区| 亚洲图片你懂的| 看电视剧不卡顿的网站| 色老综合老女人久久久| 精品国产乱码久久久久久久久| 亚洲欧美日韩系列| 国内精品久久久久影院色| 在线精品视频小说1| 久久天天做天天爱综合色| 一区二区三区久久| 国产成人精品免费视频网站| 欧美狂野另类xxxxoooo| 中文字幕在线免费不卡| 开心九九激情九九欧美日韩精美视频电影| aaa亚洲精品| 亚洲精品在线免费观看视频| 亚洲综合成人在线| 国产成人av自拍| 欧美一区二区三区免费在线看 | 国产美女娇喘av呻吟久久| 欧美色爱综合网| 国产精品你懂的| 麻豆精品视频在线观看免费| 欧美午夜精品理论片a级按摩| 中文字幕av一区二区三区| 美国十次了思思久久精品导航| 欧美中文字幕一二三区视频| 国产精品久久久久久久第一福利| 精品一区二区三区香蕉蜜桃| 欧美日韩国产经典色站一区二区三区| 国产精品久久毛片| 国产一区二三区|