C++ template机制自身是一部完整的图灵机(Turing-complete):它可以被用来计算任何可计算的值。于是导出了模板元编程(TMP, template metaprogramming),创造出“在C++编译器内执行并于编译完成时停止执行”的程序。 41:了解隐式接口和编译期多态 所谓 ...
分类:
编程语言 时间:
2018-07-30 11:10:51
阅读次数:
150
阅读了fluent python的metaprogramming这一大章节,下面对阅读后产生的感想做一下总结。 首先是关于对象 属性 访问的4个protocol 按照理解可以划分为 __getattribute__ 和 __getattr__ __setattr__ __delattr__ 这样划分 ...
分类:
编程语言 时间:
2018-05-04 17:03:37
阅读次数:
189
Metaprogramming https://en.wikipedia.org/wiki/Metaprogramming 愿编程, 是一中编程技术, 制造的计算机程序,具有能力, 对待程序为他们的数据。 针对程语言的编程技术。 Metaprogramming is a programming te ...
分类:
Web程序 时间:
2018-03-02 01:23:04
阅读次数:
241
1. TMP是什么? 模板元编程(template metaprogramming TMP)是实现基于模板的C++程序的过程,它能够在编译期执行。你可以想一想:一个模板元程序是用C++实现的并且可以在C++编译器内部运行的一个程序,它的输出——从模板中实例化出来的C++源码片段——会像往常一样被编译 ...
分类:
编程语言 时间:
2017-04-15 13:29:11
阅读次数:
305
Algorithms API Wrappers Bayesian Nets Compression Containers Graph Tools Image Processing Linear Algebra Machine Learning Metaprogramming Miscellaneou ...
分类:
其他好文 时间:
2017-03-17 20:45:07
阅读次数:
209
条款01:把C++看作一个语言联邦 C++是一种多重范型编程语言,一个同时支持过程(procedural),面向对象(object-oriented),函数形式(functional),泛型形式(generic),元编程(metaprogramming)的语言 1、c part of C++,c++ ...
分类:
编程语言 时间:
2016-11-20 19:00:44
阅读次数:
201
new.target is a new “magical” value available in all functions, thoughin normal functions it will always be undefined. In any constructor,new.target a ...
分类:
编程语言 时间:
2016-06-13 21:47:31
阅读次数:
123
Each function should have a 'name' property. It can be anonymous, empty, the same as function name, or class name. For example: ...
分类:
编程语言 时间:
2016-06-13 18:58:39
阅读次数:
176
Somehow it looks like reflect in Java. For example: We define an mothod on the Object, it called defineMethod(). It accepts two arguements, one is met ...
分类:
编程语言 时间:
2016-05-02 07:08:02
阅读次数:
222
1.需求 写一个基于memcache的cache模块, 需要在key前面加上特定的前缀, 所以user cache的原始的store函数应该写成 由于加前缀的操作(key_encode/1)是所有存入cache前必须要做的事, 所以我们可以考虑通过metaprogramming来定义一个行为叫bef ...
分类:
其他好文 时间:
2016-04-05 00:29:54
阅读次数:
321