Code Monkey home page Code Monkey logo

mplc's Introduction

mplc

use c++ template metaprogramming technique to bootstrap the c programming language

如你所见这只是一个用来证明C艹黑科技的娱乐库.即便如此我也需前置声明一些东西,一个合理概念上的c++ template metaprogramming是只依赖C++编译期的,这个期间通常又称为纯函数语言时期,在此期间元数据和元函数[类]是不可变的且没有副作用,但是这和我们的娱乐精神相违背,因为这种特性导致我们造出来的玩具几乎没有可玩性,所以我们必须导入少量的运行期元素.我能做的是尽量最小化运行期成分,并可能会考虑统计运行期成分比例(小得可怜),如果还是不能说服完美主义者我很抱歉.

if-statement

#include <iostream>
#include "if_.hpp"

int main(){
	using namespace mplc;
	if_ <
		int_<1>
	>::then_<
		if_<bool_<true>>::then_<long>::type
	>::else_<
		double
	>::type longa;
	longa = 5000;
	std::cout<<longa;
	return 0;
}

while-statement

#include "operator_less_.hpp"
#includue "int_.hpp"
#include "if_.hpp"
#inlcude "while_hpp"
#include "bool_.hpp"

int main() {
	using namespace mplc;
	while_ <
		if_<
		less<int_<9>, int_<7>>
		>::then_<true_>::else_<false_>::type
	> t;
	return 0;
}

mplc's People

Contributors

y1yang0 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.