【发布时间】:2017-06-27 15:57:38
【问题描述】:
我有一个显示某些内容的函数,其中字符位置可能不同。函数如下所示:
void display(std::ostream & stream, std::ios_base & positioning);
但是,当我尝试像这样调用这个函数时
display_header(std::cout, std::left);
我收到以下错误
error: non-const lvalue reference to type 'std::ios_base' cannot bind to a value of unrelated type 'std::ios_base &(std::ios_base &)'
我不明白为什么std::cout 可以很好地通过,但std::left 拒绝这样做。还有lvalue reference to type 'std::ios_base' 和lvalue reference to type 'std::ios_base' 有什么不同?
【问题讨论】:
标签: c++ io stream output manipulators