#include <vector>
#include <string>
class ListBuilder {
private:
std::vector<std::string> data;
public:
ListBuilder& operator<<(const std::string& str) {
data.push_back(str);
return *this;
}
void clear() {
data.clear();
}
std::vector<std::string> getData() const {
return data;
}
};
#include <iostream>
int main() {
auto vec = (ListBuilder() << "hello" << "world" << "!").getData();
for(auto& i : vec)
std::cout << i << '\n';
std::cout << vec.size();
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPHN0cmluZz4KCmNsYXNzIExpc3RCdWlsZGVyIHsKcHJpdmF0ZToKICAgIHN0ZDo6dmVjdG9yPHN0ZDo6c3RyaW5nPiBkYXRhOwpwdWJsaWM6CiAgICBMaXN0QnVpbGRlciYgb3BlcmF0b3I8PChjb25zdCBzdGQ6OnN0cmluZyYgc3RyKSB7CiAgICAgICAgZGF0YS5wdXNoX2JhY2soc3RyKTsKICAgICAgICByZXR1cm4gKnRoaXM7CiAgICB9CiAgICB2b2lkIGNsZWFyKCkgewogICAgICAgIGRhdGEuY2xlYXIoKTsKICAgIH0KCiAgICBzdGQ6OnZlY3RvcjxzdGQ6OnN0cmluZz4gZ2V0RGF0YSgpIGNvbnN0IHsKICAgICAgICByZXR1cm4gZGF0YTsKICAgIH0KfTsKCiNpbmNsdWRlIDxpb3N0cmVhbT4KCmludCBtYWluKCkgewogICAgYXV0byB2ZWMgPSAoTGlzdEJ1aWxkZXIoKSA8PCAiaGVsbG8iIDw8ICJ3b3JsZCIgPDwgIiEiKS5nZXREYXRhKCk7CiAgICBmb3IoYXV0byYgaSA6IHZlYykKICAgICAgICBzdGQ6OmNvdXQgPDwgaSA8PCAnXG4nOwogICAgc3RkOjpjb3V0IDw8IHZlYy5zaXplKCk7Cn0=