I see statements like
typedef *unspecified* value_type;
typedef *unspecified* reference;
in the declaration of Boost::multi_array class.
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;
what does the *unspecified* mean here? Is this a C++11 standard?
I'm assuming this in documentation, not compilable code, since it isn't compilable.
It's common to do this to indicate that the typedef is available for use, but the type that it aliases depends on the implementation and isn't considered part of the public interface.
In this case, the compilable header file contains declarations along the lines of:
typedef typename super_type::value_type value_type;
where the aliased type is defined in a base class. Digging deeper, that in turn comes from another base class, and the actual type is deeply buried in the implementation details, with different definitions depending on how many dimensions the array has; this particular type is ValueType
for a one-dimensional array, and multi_array<ValueType,NumDims-1>
for higher dimensions.
That looks like it's copied from this documentation. *unspecified*
just means, that it is totally irrelevant to you and that it's an implementation detail. Don't look further into it, just acknowledge, that the typedefs are there.
I just opened the multi_array.hpp header, and (as expected) it has no such typedefs, but it looks like this :
template<typename T, std::size_t NumDims,typename Allocator>
class multi_array :
public multi_array_ref<T,NumDims>
{
typedef multi_array_ref<T,NumDims> super_type;
public:
typedef typename super_type::value_type value_type;
typedef typename super_type::reference reference;
typedef typename super_type::const_reference const_reference;
typedef typename super_type::iterator iterator;
typedef typename super_type::const_iterator const_iterator;
typedef typename super_type::reverse_iterator reverse_iterator;
typedef typename super_type::const_reverse_iterator const_reverse_iterator;
typedef typename super_type::element element;
typedef typename super_type::size_type size_type;
typedef typename super_type::difference_type difference_type;
typedef typename super_type::index index;
typedef typename super_type::extent_range extent_range;
// ...
If you are reading the reference pages for boost::multi_array, then it means that you should use that typedef, instead of your own type. I guess those typedefs should be really used when writing template classes.
No. It means that a specific implementation may typedef it to be whatever it wants. This is in a specification- not actual compilable C++.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With