Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- #include <set>
- #include <string>
- class Json { };
- class Builder {
- class BuilderContext;
- class DictValueContext;
- public:
- Builder();
- DictValueContext Key(std::string key);
- private:
- Json* json;
- class BaseContext {
- public:
- BaseContext(Builder& builder)
- : builder_(builder)
- {
- }
- DictValueContext Key(std::string key)
- {
- return builder_.Key(std::move(key));
- }
- private:
- Builder& builder_;
- };
- class DictValueContext : public BaseContext {
- public:
- DictValueContext(BaseContext base)
- : BaseContext(base)
- {
- }
- DictValueContext Key(std::string key) = delete;
- };
- };
- Builder::Builder()
- : json(new Json)
- {
- }
- Builder::DictValueContext Builder::Key(std::string key)
- {
- return BaseContext { *this };
- }
- int main() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement