在C ++元编程中存储状态? [英] Storing States in C++ Metaprogramming?

查看:67
本文介绍了在C ++元编程中存储状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在C ++元程序中存储状态?我不确定我的意思,但是我想要一个可以分配"到的模板类,例如可以通过使用C ++模板来更改state::value.

Is it possible to store states in C++ metaprograms? I'm not entirely sure what I mean, but I want a template class that can be "assigned" to, e.g. state::value can be changed via the use of C++ templates.

我知道我听起来可能很模糊,但是我希望有人能理解我在说什么(也请不要使用Boost.MPL).

I know I probably sound very vague, but I hope someone understands what I'm talking about (also please no Boost.MPL).

推荐答案

不可能,C ++的TMP部分是一种纯粹的功能性语言,没有副作用的概念.

It's not possible, the TMP part of C++ is a purely functional language without the concept of side effects.

这篇关于在C ++元编程中存储状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆