[英]Emulate Import as functionality from python in C++
在python中,我可以執行以下操作:
from long_and_painful import still_way_to_long as short
在C ++中,我堅持:
using long::and::painful::stillWayToLong;
... //Code and Stuff
stillWayToLong("Why must I type this so often?");
我是否缺少使它變得更pythonic的東西?
怎么樣
auto x = long::and::painful::stillWayToLong; // If this is an object/function
x("Why must I type this so often?");
using X = typename long::and::painful::stillWayToLong; // If this is a type.
X bob;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.