
On 5/27/05, Alexander Nasonov <alnsn-boost@yandex.ru> wrote:
Arkadiy Vertleyb <vertleyb <at> hotmail.com> writes:
I think they are:
template<class T> char foo(vector<T>& v)[id1][id2][id3];
But how would this work? This array type will stay inside the function.
#include <boost/mpl/assert.hpp> #include <boost/mpl/equal.hpp> #include <boost/mpl/vector_c.hpp>
char (&foo())[9][8][7][6];
int main() { using namespace boost::mpl;
typedef vector_c< int , sizeof(foo()) / sizeof(foo()[0]) , sizeof(foo()[0]) / sizeof(foo()[0][0]) , sizeof(foo()[0][0]) / sizeof(foo()[0][0][0]) , sizeof(foo()[0][0][0]) / sizeof(foo()[0][0][0][0]) > vec;
BOOST_MPL_ASSERT(( equal< vec, vector_c<int,9,8,7,6> > )); }
Sizes may become very huge, though.
If you replace your function with: char (&foo())[900][800][700][600]; you will get an overflow when calculating e.g. sizeof(foo()) / sizeof(foo()[0]), and the result will be garbage.
We need a function to return the object of certain _size_ in order to pass it outside...
I don't understand it.
-- Alexander Nasonov
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost