c++ - C++ typedef 语句中的 *unspecified* 是什么意思?

标签 c++ c++11 typedef declaration

我看到这样的语句

typedef *unspecified* value_type;

typedef *unspecified* reference;

在 Boost::multi_array 类的声明中。

    namespace boost {

template <typename ValueType, 
          std::size_t NumDims, 
          typename Allocator = std::allocator<ValueType> >
class multi_array {
public:
// types:
  typedef ValueType                             element;
  typedef *unspecified*                         value_type;
  typedef *unspecified*                         reference;
  typedef *unspecified*                         const_reference;
  typedef *unspecified*                         difference_type;
  typedef *unspecified*                         iterator;
  typedef *unspecified*                         const_iterator;
  typedef *unspecified*                         reverse_iterator;
  typedef *unspecified*                         const_reverse_iterator;
  typedef multi_array_types::size_type          size_type;
  typedef multi_array_types::index              index;
  typedef multi_array_types::index_gen          index_gen;
  typedef multi_array_types::index_range        index_range;
  typedef multi_array_types::extent_gen         extent_gen;
  typedef multi_array_types::extent_range       extent_range;
  typedef *unspecified*                         storage_order_type;

这里的 *unspecified* 是什么意思?这是 C++11 标准吗?

最佳答案

我假设这是在文档中,而不是可编译代码中,因为它不可编译。

通常这样做是为了表明 typedef 可以使用,但它别名的类型取决于实现并且不被视为公共(public)接口(interface)的一部分。

在这种情况下,可编译头文件包含以下行的声明:

typedef typename super_type::value_type value_type;

别名类型在基类中定义。深入挖掘,它又来自另一个基类,实际类型深埋在实现细节中,根据数组的维数有不同的定义;这种特殊类型是 ValueType对于一维数组,multi_array<ValueType,NumDims-1>对于更高的维度。

关于c++ - C++ typedef 语句中的 *unspecified* 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5580757/

相关文章:

c++ - 元组作为函数参数

c - 将 main 中定义的类型传递给 C 中的 header

java - 如何在swig中使用同一个接口(interface)生成两个代理类

javascript - 如何在我的应用程序堆栈中处理非ASCII UTF-8字符

c++ - 当用户按下某些键时,如何制作一个改变颜色的正方形?

c++ - 在它自己的析构函数中移动 unique_ptr 是否可以?

c - 具有 typedef 和数组时 c 中 const 的问题

c++ - 进程保护

c# - 当 c# 访问 c++ dll 时尝试读取或写入 protected 内存错误

c++ - 如果我只使用指向基类的指针,更改私有(private)派生类是否会影响 ABI?