How can I write a templated typedef
or using
, such that
int arr[N];
is actually either
std::vector<int> arr(N); /// C++03
or
std::array<int, N> arr; /// C++11
I followed this answer. Can I write something similar to this
template <std::size_t N>
using int[N] = std::array<int, N>;
or a templated typedef
template <std::size_t N>
typedef int std::array<int, N> [N];
Also, I want the same with char[]
and std::string
. Is it possible ?
EDIT This is what I want to do
int arr[10]; // Declare an int array but use it as std::vector
arr.resize(20);
... // Other methods from std::vector class