草庐IT

program-structure

全部标签

c++ - "structured bindings"与 "decomposition declarations"

观察:在P0217R3proposal(2016-06-24),使用了结构化绑定(bind)术语。在currentworkingC++1zdraft(2016-11-28),使用了分解声明术语。在P0615R0proposal(2017-03-01),分解声明被重命名为结构化绑定(bind)。引人注目,thisblogpost(2017-01-09)包含以下文本:Decompositiondeclarations.[..]Wasoriginallycalled"structuredbindings".同样,thisquestion(2017-03-04)包含以下文本:[..]C++17

c++ - "structural binding"上的提案在哪里?

在下面C++Goingnativevideo,提到了一种称为“结构绑定(bind)”的语言功能。我曾经有过referred将这个概念称为“解构”(javascript背景)。该功能将允许用户捕获多个返回值,而无需使用std::tie或指定类型。示例:std::maptable;auto{cursor,inserted}=table.insert({"hello",0});我在哪里可以找到此提案并跟踪其进度? 最佳答案 您所指的提案是P0144R0:StructuredBindings.post-Konamailing将这篇论文列为进

c++ - boost/STD/AKKA : How do I do actor programming in C++?

(改写问题和描述以便与S.O.兼容)奇怪的是,C++还没有被广泛采用、经过同行评审的actor模型库(按BOOST和STD的顺序)。我看到Theron,但它看起来像一个人和他的代码:无论它有多好,它都不是我希望生产代码依赖的东西。因此,如何在不使用未经证实的库的情况下使用C++进行Actor模型编程?我应该使用哪些BOOST类(class)?注意:我是在面对之前关于S.O.的一两个问题时问这个问题的。当人们搜索“actorC++”时就会出现,因为它们几乎没有吸引力。对于SEESHARP,有thisthread但对于C++,即使是获得中等关注度的问题也是如此thisguy,aquesti

c++ - 如何构建 Boost::program_options

我想使用boost::program_options。安装boost后,我​​认为我必须单独构建program_options(http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html)。但我不知道该怎么做。我正在尝试编译C:\ProgramFiles\boost\boost_1_42\libs\program_options\example\first.cpp(http://www.boost.org/doc/libs/1_42_0/doc/html/program_options/tutorial.

c++ - 使用 boost.program_options 处理 '-'

在你说OVERKILL之前,我不在乎。如何让Boost.program_options处理所需的cat选项-?我有//visiblepo::options_descriptionoptions("Options");options.add_options()("-u",po::value(),"Writebytesfromtheinputfiletothestandardoutputwithoutdelayaseachisread.");po::positional_options_descriptionfile_options;file_options.add("file",-1);

c++ - 来自 "The C++ Programming Language 4th Edition"第 19.3.3.1 节的代码是否有效?

第19.3节在一个主要关注运算符重载的章节中介绍了字符串表示,特别是特殊运算符[]、->和()。它将copy_from()作为辅助函数实现如下:voidString::copy_from(constString&x)//make*thisacopyofx{if(x.sz类接口(interface)如下所示:#ifndefSTRING_EXERCISE_H#defineSTRING_EXERCISE_Hnamespacesimple_string{classString;char*expand(constchar*ptr,intn);}classString{public:String(

c++ - 如何在 Boost::Program_Options 中支持命令行语法 "-DEVICE:iphone"?

Boost::Program_Options的默认语法是“--DEVICEiphone”。如何支持语法“-DEVICE:iphone”或“-DEVICE=iphone”? 最佳答案 Boost.Program_Options有相当多的optionstyles.您似乎想要的特定组合是:command_line_style::long_allow_adjacent|command_line_style::short_allow_adjacent|command_line_style::allow_long_disguise应该将这些选项

c++ - 现代 C 和 C++ : it is possible to use one defined structure for other declared structure?

假设我想制作某种支持加载图形Image的引擎,所以我有structImage;Image*load_image_from_file(...);我不想让外部世界知道Image到底是什么,他们只会处理指向它的指针。但是在engine内部我想使用特定的类型,例如SDL_Surface在SDL中完全定义。我能否以某种方式重新定义此文件的图像,以便编译器在每次看到Image*(宏除外)时都假定为SDL_Surface*?即我想要像typedefstructSDL_SurfaceImage;这样的东西所有的尝试都像usingImage=SDL_Surface;typedefSDL_SurfaceI

c++ - Boost Program_Options 抛出 "character conversion failed"

我在Ubuntu14.04上,使用CMake和CLion。我正在尝试使用程序选项,以下代码取自其文档中的示例:#include#includeintmain(intac,char*av[]){namespacepo=boost::program_options;usingnamespacestd;po::options_descriptiondesc("Allowedoptions");desc.add_options()("help","producehelpmessage")("compression",po::value(),"setcompressionlevel");po::

c++ - 如何为 boost::program_options 的位置选项添加描述?

我想用boost_program_options创建一个位置列表程序选项,不允许命名程序选项(如--files)。我有以下代码片段:#include#include#include#includenamespacepo=boost::program_options;intmain(intargc,constchar*argv[]){po::options_descriptiondesc("Allowedoptions");desc.add_options()("help","producehelpmessage")("files",po::value>()->required(),"l