Persistent variable
We override operator= in a wrapper to create variables with custom storage
structure |
---|
| struct nxi : ndb::persistent_group
{
using persistent_group::persistent_group;
struct : ndb::persistent_group
{
using persistent_group::persistent_group;
ndb::persistent<std::string> home{ this, "home", "test" };
ndb::persistent<bool> zeta{ this, "zeta" };
struct : ndb::persistent_group
{
using persistent_group::persistent_group;
ndb::persistent<int> min_width{ this, "min_width" };
ndb::persistent<std::string> max_width{ this, "max_width" };
} tabs{ this, "tabs" };
} browser{ this, "browser" };
};
|
usage |
---|
| ::nxi nxi{ "nxi" };
nxi.browser.home = std::string("dev.neuroshok.com");
nxi.browser.tabs.max_width = "10";
nxi.browser.tabs.min_width = 20;
nxi.browser.zeta = true;
|