Basically, a constant (like "const int some_constant_value = 42;"), whether it is at global scope, namespace scope, or a static data member, has to be assigned to a value that can be resolved at compile-time regardless of when it is initialized.
So, this excludes any variable that is not also a constant. It only allows literal values or other constants, and simple arithmetic operations on literal values and/or other constants. And also #defines, but those are evil.
In the example you gave, since a vector (I'm assuming not a static array) only has a size that can be know at run-time, because it has to be initialized (i.e. created) before it has a known size, and objects only get created at run-time. So, in order to have another array or vector whose size depends on the size of that other vector, it will have to be created at run-time (as firstPerson suggested, using dynamically allocated memory).
If you are talking about the special case where you have a static array (fixed-size, known at compile-time) and you simply want to create another static array of the same size, but you don't want to use a global constant for it, there is a little trick that can be used, but it is not so pretty:
int array1; //say you have this static array, with a "magic number" for its size.
//you can use the sizeof() operator to get the total size in bytes of a _static_ array (only for a static array).
double array2[sizeof(array1) / sizeof(array1)]; //it's not pretty, but it works.
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
OK, so HostGator for some reason no longer allows gcc/g++ access unless you have a Designated Server account, which is a lot of money to spend just to compile my "Hello World" program. Thus I figured I'd compile at home, then upload. Program is your regular old bare-bones Hello World ...