小编ygr*_*ram的帖子

为什么C++ 11会覆盖而最终不是属性?

我不知道错过了C++ 11中引入的属性.现在我发现了,我想知道为什么override并且final被添加为具有特殊含义的标识符而不是标准属性.

目的override是生成编译时错误,这也是许多标准属性的目的.感觉好像他们会适应这个概念,但我可能有理由错过这个概念.

c++ c++11

6
推荐指数
1
解决办法
338
查看次数

如何从boost :: errinfo_nested_exception中提取任何信息?

我最近开始使用boost :: exception.现在我想使用boost :: errinfo_nested_exception来打印有关错误原因的信息.问题是我无法弄清楚如何从原因中获取信息.我试过以下但没有成功:

#include <iostream>
#include <boost/exception/all.hpp>

struct myex : public virtual boost::exception {};

int main()
{
   myex cause;
   cause << boost::errinfo_file_name("causefile.cpp");

   try {
      myex ex;
      ex << boost::errinfo_nested_exception(boost::copy_exception(cause));
      throw ex;
   }
   catch (myex& e) {
      // Here I would like to extract file name from cause and print
      // it in a nice way, but I cant figure out what to do with a
      // boost::exception_ptr.
      const boost::exception_ptr* c = 
         boost::get_error_info<boost::errinfo_nested_exception>(e);

      // I cant do this:  
      // …
Run Code Online (Sandbox Code Playgroud)

c++ boost exception

5
推荐指数
1
解决办法
3233
查看次数

elisp中的match-string没有返回字符串匹配的字符串

我有一个问题,我在字符串匹配后无法获得匹配字符串.我认为字符串匹配有效,至少它返回非nil,但是当我尝试获取match-string时出现错误.我该怎么办?

失败的功能:

(defun small-test ()
  (string-match "\\([0-9]+\\)-v\\([0-9]+\\).txt" "2011-v9.txt")
  (message (match-string 1))
  )
Run Code Online (Sandbox Code Playgroud)

regex elisp

4
推荐指数
1
解决办法
1815
查看次数

标签 统计

c++ ×2

boost ×1

c++11 ×1

elisp ×1

exception ×1

regex ×1