#include <iostream>
#include <vector>
#include <type_traits>
using namespace std;
template <typename T>
struct NaiveVector {
vector<T> v;
NaiveVector(size_t num, const T &val) : v(num, val) {
cout << "(int num, const T &val)" << endl;
}
template <typename InputIterator,
typename ::std::enable_if<
::std::is_constructible<
T,
decltype(*::std::declval<InputIterator>())
>::value
>::type* = nullptr
>
NaiveVector(InputIterator first, InputIterator last) : v(first, last) {
cout << "(InputIterator first, InputIterator last)" << endl;
}
size_t size() const { return v.size(); }
};
int main() {
vector<bool> vec({true, false, true, true});
NaiveVector<bool> myVec2(vec.cbegin(), vec.cend());
cout << "size = " << myVec2.size() << endl;
for (auto n : myVec2.v) { cout << n << " "; }
cout << endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8dHlwZV90cmFpdHM+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdGVtcGxhdGUgPHR5cGVuYW1lIFQ+CnN0cnVjdCBOYWl2ZVZlY3RvciB7CiAgdmVjdG9yPFQ+IHY7CiAgTmFpdmVWZWN0b3Ioc2l6ZV90IG51bSwgY29uc3QgVCAmdmFsKSA6IHYobnVtLCB2YWwpIHsKICAgIGNvdXQgPDwgIihpbnQgbnVtLCBjb25zdCBUICZ2YWwpIiA8PCBlbmRsOwogIH0KCnRlbXBsYXRlIDx0eXBlbmFtZSBJbnB1dEl0ZXJhdG9yLAogICAgICAgICAgdHlwZW5hbWUgOjpzdGQ6OmVuYWJsZV9pZjwKICAgICAgICAgICAgICA6OnN0ZDo6aXNfY29uc3RydWN0aWJsZTwKICAgICAgICAgICAgICAgICAgVCwKICAgICAgICAgICAgICAgICAgZGVjbHR5cGUoKjo6c3RkOjpkZWNsdmFsPElucHV0SXRlcmF0b3I+KCkpCiAgICAgICAgICAgICAgPjo6dmFsdWUKICAgICAgICAgID46OnR5cGUqID0gbnVsbHB0cgo+CiAgTmFpdmVWZWN0b3IoSW5wdXRJdGVyYXRvciBmaXJzdCwg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