How about the following? I'm particularly interested in the const references.

P.S For all practical purposes this syntax is meaningless. The size of the array is deduced from the number of arguments only. Other code has no means of finding out the size of the dynamically allocated array. (Compare with how you can find out the size of the stack array even if you let the array's size be deduced from the initalization arguments.)Code:`#include <iterator>`

#include <iostream>

using namespace std;

namespace detail

{

template <class, class, unsigned>

class block_n;

template <class Block, class T, unsigned N>

T* allocate(const block_n<Block, T, N>& block);

template <class Block, class T, unsigned N>

class block_n

{

const Block& left;

const T& value;

public:

block_n(const Block& left, const T& value): left(left), value(value) {}

block_n<block_n<Block, T, N>, T, N + 1u> operator, (const T& t) const

{

return block_n<block_n<Block, T, N>, T, N + 1u>(*this, t);

}

T* assign(T* p) const

{

p = left.assign(p);

*p = value;

return ++p;

}

operator T* () const

{

return allocate(*this);

}

};

template <class T>

class block_n<void, T, 1u>

{

const T& value;

public:

block_n(const T& t): value(t) {}

block_n<block_n<void, T, 1u>, T, 2u> operator, (const T& t) const

{

return block_n<block_n<void, T, 1u>, T, 2u>(*this, t);

}

T* assign(T* p) const { *p = value; return ++p; }

operator T* () const

{

return allocate(*this);

}

};

template <class Block, class T, unsigned N>

T* allocate(const block_n<Block, T, N>& block)

{

T* p = new T[N];

try {

block.assign(p);

} catch (...) {

delete [] p;

throw;

}

return p;

}

} //namespace detail

template <class T>

class block

{

public:

detail::block_n<void, T, 1u> operator, (const T& t)

{

return detail::block_n<void, T, 1u>(t);

}

};

int main( void )

{

int* array = ( block< int >( ), 1, 2, 3 );

copy( array, array + 3, ostream_iterator< int, char >( cout, "\n" ) );

return 0;

}

Best thing to do is to hope that the hard-coded 3 in the copy call is correct and no-one removes any arguments from the initialization...