c++ - Can I change the meaning of `int arr[N]` using `typedef` or `using`? -


how can write templated typedef or using, such that

int arr[n]; 

is either

std::vector<int> arr(n);    /// c++03 

or

std::array<int, n> arr;    /// c++11 

i followed this answer. can write similar this

template <std::size_t n> using int[n] = std::array<int, n>; 

or templated typedef

template <std::size_t n> typedef int std::array<int, n> [n]; 

also, want same char[] , std::string. possible ?

edit want do

int arr[10];    // declare int array use std::vector arr.resize(20); ...   // other methods std::vector class 

if mean want change meaning of int[n] std::vector or std::array

no, can't that.

array-declarator notation int[n] fixed language construct , cannot re-purposed.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -