A
aaragon
Hello everyone,
I was wondering if there is a way to determine the size of an array at
runtime. Let's say I have a class that has one of its constructors
taking an array:
template <class T>
class A {
// constructors
....
A(const T array[]) {
// use array
}
// other fns...
};
So of course I cannot use the sizeof operator because the array can be
created at runtime, so sizeof(array)/sizeof(array[0]) won't work. Now,
operator delete[] can still figure the size of an array, right?
Therefore, there has to be a way to determine the size of it.
Thanks for viewing my post.
aa
I was wondering if there is a way to determine the size of an array at
runtime. Let's say I have a class that has one of its constructors
taking an array:
template <class T>
class A {
// constructors
....
A(const T array[]) {
// use array
}
// other fns...
};
So of course I cannot use the sizeof operator because the array can be
created at runtime, so sizeof(array)/sizeof(array[0]) won't work. Now,
operator delete[] can still figure the size of an array, right?
Therefore, there has to be a way to determine the size of it.
Thanks for viewing my post.
aa