Instead of the new_intrusive<T>() functions, use intrusive(new T)

This means we no longer need 8 different functions for different numbers of arguments, and non-const references can now also be passed to constructors without problems.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1443 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2010-07-21 14:32:28 +00:00
parent 8800500d86
commit 51dfed69b4
66 changed files with 304 additions and 353 deletions
+6 -6
View File
@@ -28,13 +28,13 @@ DECLARE_TYPEOF_NO_REV(IndexMap<FieldP COMMA ValueP>);
// ----------------------------------------------------------------------------- : Set
Set::Set()
: vcs (new_intrusive<VCS>())
: vcs (intrusive(new VCS()))
, script_manager(new SetScriptManager(*this))
{}
Set::Set(const GameP& game)
: game(game)
, vcs (new_intrusive<VCS>())
, vcs (intrusive(new VCS()))
, script_manager(new SetScriptManager(*this))
{
data.init(game->set_fields);
@@ -43,7 +43,7 @@ Set::Set(const GameP& game)
Set::Set(const StyleSheetP& stylesheet)
: game(stylesheet->game)
, stylesheet(stylesheet)
, vcs (new_intrusive<VCS>())
, vcs (intrusive(new VCS()))
, script_manager(new SetScriptManager(*this))
{
data.init(game->set_fields);
@@ -163,7 +163,7 @@ void Set::validate(Version file_app_version) {
}
*/ }
// we want at least one card
if (cards.empty()) cards.push_back(new_intrusive1<Card>(*game));
if (cards.empty()) cards.push_back(intrusive(new Card(*game)));
// update scripts
script_manager->updateAll();
}
@@ -231,7 +231,7 @@ void Set::reflect_cards<Writer> (Writer& tag) {
// ----------------------------------------------------------------------------- : Script utilities
ScriptValueP make_iterator(const Set& set) {
return new_intrusive1<ScriptCollectionIterator<vector<CardP> > >(&set.cards);
return intrusive(new ScriptCollectionIterator<vector<CardP> >(&set.cards));
}
void mark_dependency_member(const Set& set, const String& name, const Dependency& dep) {
@@ -276,7 +276,7 @@ int Set::positionOfCard(const CardP& card, const ScriptValueP& order_by, const S
Profiler prof(t, order_by.get(), _("init order cache"));
#endif
// 3. initialize order cache
order = new_intrusive3<OrderCache<CardP> >(cards, values, filter ? &keep : nullptr);
order = intrusive(new OrderCache<CardP>(cards, values, filter ? &keep : nullptr));
}
return order->find(card);
}