#include <iostream>
#include <functional>
#include <string>

class StringProxyDemo {
public:
	class Proxy {
	public:
		Proxy(std::string value) : _value(std::move(value)) { }
		std::string *operator->() { return &_value; }
	private:
		std::string _value;
	};
	
	Proxy operator->() {
		return _function();
	}
	
	StringProxyDemo(std::function<std::string()> function)
	: _function(std::move(function)) { }
	
private:
	std::function<std::string()> _function;
};

int main() {
	StringProxyDemo demo(
		[]() -> std::string {
			return "Hello, World!";
		}
	);
	std::cout << demo->size() << std::endl;
	std::cout << demo->c_str() << std::endl;
}
