相关疑难解决方法(0)

我在哪里可以找到当前的C或C++标准文档?

对于许多问题,答案似乎可以在"标准"中找到.但是,我们在哪里找到它?最好是在线.

谷歌搜索有时会觉得徒劳,尤其是对于C标准,因为他们在编程论坛的大量讨论中被淹没.

要开始这个,因为这些是我现在正在搜索的,那里有很好的在线资源:

  • C89
  • C99
  • C11
  • C++ 98
  • C++ 03
  • C++ 11
  • C++ 14

c c++ standards c++-faq

394
推荐指数
8
解决办法
12万
查看次数

运算符重载<< needs const; 产生头痛

我试图超载operator <<,但它总是需要成为一个const功能.但是,我想更改此重载函数中的值.我该怎么做呢?

EDIT1:代码存根如下所示:

class Check

{   
public:
    void operator << (boost::any)
    {
        // checks weather the given is hresult,string(filename) or int(line no) 
        // and dump them into the exception object, 
        // There by hresult will initiate the object and int will throw the object.
        // so the input order must be like below
    }
private:
    Exception exception;
};
Run Code Online (Sandbox Code Playgroud)

用法

Check   check;
check << file->open << __FILE__ << __LINE__ ;
Run Code Online (Sandbox Code Playgroud)

编辑2:这是谁曾经说过语法不好实现我不是一个很好的exp.程序员.我只是试图快速解决异常问题.我的动机是它不应该消耗更多的时间,它应该很容易打字.因为我的同事必须使用这个异常类.我试图找到一个解决方案,答案来自<<运算符重载.例如,考虑以下示例

1)我的方法

#define INFO __LINE__ …
Run Code Online (Sandbox Code Playgroud)

c++ logic operator-overloading visual-c++

1
推荐指数
2
解决办法
381
查看次数

标签 统计

c++ ×2

c ×1

c++-faq ×1

logic ×1

operator-overloading ×1

standards ×1

visual-c++ ×1