zoukankan      html  css  js  c++  java
  • generic or template

    If you compare the CLR generics proposed by Microsoft Research (see
    http://research.microsoft.com/projec...n/generics.pdf) to C++
    templates, you'll find some differences:

    * CLR Generics are supported in the CLR, with instantiation occuring at
    runtime. Full metadata exists for the generic type, and generic
    instantiations can be reflected upon through meta-data.

    * C++ Templates are a compile-time only mechanism. C++ template
    instantiations are ordinary classes with extraordinary names. When compiled
    to managed code, each template is a distinct .NET class, and the
    meta-relationship between those classes is not represented in the metadata
    anywhere.

    * C++ templates support partial specialization. There's nothing comparable
    in CLR Generics.

    * CLR Generics support type constraints on generic parameters. There's
    nothing comparable in C++ templates (although it's possible to synthesize
    similar mechanisms in some cases).

    * C++ Templates are a Turing-complete functional language that's executed by
    the compiler. CLR Generics are simply generic types.

  • 相关阅读:
    排座椅
    关于math.h的问题
    客户调查
    排队打水
    删数游戏
    小数背包
    零件分组
    桐桐的组合
    桐桐的数学游戏
    桐桐的全排列
  • 原文地址:https://www.cnblogs.com/Cmpl/p/2163856.html
Copyright © 2011-2022 走看看