我看到这样的语句
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/