#include <iostream>
#include <initializer_list>
#include <iterator>
#include <array>
#include <vector>
#include <sstream>
struct A
{
template < typename ITERATOR > A( ITERATOR begin, ITERATOR end )
{
std::cout << "A::constructor - " ;
for( ; begin != end ; ++begin ) std::cout << *begin << ' ' ;
std::cout << '\n' ;
}
template < typename T >
A( std::initializer_list<T> range ) : A( std::begin(range), std::end(range) ) {}
template < typename RANGE >
A( const RANGE& range, decltype( std::begin(range) )* = nullptr )
: A( std::begin(range), std::end(range) ) {}
};
int main()
{
double carray[] { 10.1, 20.2, 30.3, 40.4 } ;
A a1(carray) ; // construct from C-array (range)
std::array<long,5> array { { 12, 13, 14 } } ;
A a2(array) ; // from std::array (range)
std::vector<short> vector { 91, 92, 93 } ;
A a3(vector) ; // from sequence container (range)
A a4( { 1, 2, 3, 4, 5 } ) ; // from initializer list
std::istringstream stm( "50 60 70 80" ) ;
// from pair of iterators (
A a5( (std::istream_iterator<int>(stm)), std::istream_iterator<int>() ) ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW5pdGlhbGl6ZXJfbGlzdD4KI2luY2x1ZGUgPGl0ZXJhdG9yPgojaW5jbHVkZSA8YXJyYXk+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxzc3RyZWFtPgoKc3RydWN0IEEKewogICAgdGVtcGxhdGUgPCB0eXBlbmFtZSBJVEVSQVRPUiA+IEEoIElURVJBVE9SIGJlZ2luLCBJVEVSQVRPUiBlbmQgKQogICAgewogICAgICAgIHN0ZDo6Y291dCA8PCAiQTo6Y29uc3RydWN0b3IgLSAiIDsKICAgICAgICBmb3IoIDsgYmVnaW4gIT0gZW5kIDsgKytiZWdpbiApIHN0ZDo6Y291dCA8PCAqYmVnaW4gPDwgJyAnIDsKICAgICAgICBzdGQ6OmNvdXQgPDwgJ1xuJyA7CiAgICB9CgogICAgdGVtcGxhdGUgPCB0eXBlbmFtZSBUID4KICAgIEEoIHN0ZDo6aW5pdGlhbGl6ZXJfbG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