use make_unique with gcc4.9
This commit is contained in:
parent
c4d5b9f5cc
commit
b3530a43ff
|
@ -47,7 +47,7 @@ Realm::Config::Config(const Config& c)
|
||||||
, migration_function(c.migration_function)
|
, migration_function(c.migration_function)
|
||||||
{
|
{
|
||||||
if (c.schema) {
|
if (c.schema) {
|
||||||
schema.reset(new Schema(*c.schema));
|
schema = std::make_unique<Schema>(*c.schema);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,14 +68,14 @@ Realm::Realm(Config config)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (m_config.read_only) {
|
if (m_config.read_only) {
|
||||||
m_read_only_group.reset(new Group(m_config.path, m_config.encryption_key.data(), Group::mode_ReadOnly));
|
m_read_only_group = std::make_unique<Group>(m_config.path, m_config.encryption_key.data(), Group::mode_ReadOnly);
|
||||||
m_group = m_read_only_group.get();
|
m_group = m_read_only_group.get();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_history = realm::make_client_history(m_config.path, m_config.encryption_key.data());
|
m_history = realm::make_client_history(m_config.path, m_config.encryption_key.data());
|
||||||
SharedGroup::DurabilityLevel durability = m_config.in_memory ? SharedGroup::durability_MemOnly :
|
SharedGroup::DurabilityLevel durability = m_config.in_memory ? SharedGroup::durability_MemOnly :
|
||||||
SharedGroup::durability_Full;
|
SharedGroup::durability_Full;
|
||||||
m_shared_group.reset(new SharedGroup(*m_history, durability, m_config.encryption_key.data()));
|
m_shared_group = std::make_unique<SharedGroup>(*m_history, durability, m_config.encryption_key.data(), !m_config.disable_format_upgrade);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (util::File::PermissionDenied const& ex) {
|
catch (util::File::PermissionDenied const& ex) {
|
||||||
|
@ -161,7 +161,7 @@ SharedRealm Realm::get_shared_realm(Config config)
|
||||||
if (auto existing = s_global_cache.get_any_realm(realm->config().path)) {
|
if (auto existing = s_global_cache.get_any_realm(realm->config().path)) {
|
||||||
// if there is an existing realm at the current path steal its schema/column mapping
|
// if there is an existing realm at the current path steal its schema/column mapping
|
||||||
// FIXME - need to validate that schemas match
|
// FIXME - need to validate that schemas match
|
||||||
realm->m_config.schema.reset(new Schema(*existing->m_config.schema));
|
realm->m_config.schema = std::make_unique<Schema>(*existing->m_config.schema);
|
||||||
|
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
realm->m_notifier = existing->m_notifier;
|
realm->m_notifier = existing->m_notifier;
|
||||||
|
@ -174,7 +174,7 @@ SharedRealm Realm::get_shared_realm(Config config)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// otherwise get the schema from the group
|
// otherwise get the schema from the group
|
||||||
realm->m_config.schema.reset(new Schema(ObjectStore::schema_from_group(realm->read_group())));
|
realm->m_config.schema = std::make_unique<Schema>(ObjectStore::schema_from_group(realm->read_group()));
|
||||||
|
|
||||||
// if a target schema is supplied, verify that it matches or migrate to
|
// if a target schema is supplied, verify that it matches or migrate to
|
||||||
// it, as neeeded
|
// it, as neeeded
|
||||||
|
|
Loading…
Reference in New Issue