• _MISSYOURLOVE
    2022-05-19
    弱类型就没有这种泛型的苦恼,例如世界上最好的语言PHP,一个数组几乎就可以搞定所有事情,但是性能确实比不上这些编译型语言

    作者回复: 👍

    
    1
  • Kepler
    2022-05-05
    老师,string stack应该是输出world! hello吧

    作者回复: 我用海纳老师的代码分别在MacOS和ubuntu上编译运行了一下,结果很让我吃惊: macos上输出: 3 world!hello 而ubuntu上居然输出: 3 hello world! macos上的g++版本: $g++ -v Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1 Apple LLVM version 10.0.1 (clang-1001.0.46.4) Target: x86_64-apple-darwin18.7.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin ubuntu上g++版本: gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) 按照代码语义,stack的先进后出,理论上:world! hello 应该才是对的。

    共 2 条评论
    
  • 一步
    2022-02-14
    typescript 的泛型的实现 应该是借鉴了 C++ 的实现, 都是产生一个新的类型
    共 1 条评论
    4