Don't extend explicity the life time of returned temporaries.
That sort of optimization is compiler's work.
This commit is contained in:
parent
ea49b517e8
commit
b6ee7b4460
@ -1033,7 +1033,7 @@ ConstraintTree::swapLogVar (LogVar X)
|
|||||||
{
|
{
|
||||||
size_t pos = Util::indexOf (logVars_, X);
|
size_t pos = Util::indexOf (logVars_, X);
|
||||||
assert (pos != logVars_.size());
|
assert (pos != logVars_.size());
|
||||||
const CTNodes& nodes = getNodesAtLevel (pos);
|
CTNodes nodes = getNodesAtLevel (pos);
|
||||||
for (CTNodes::const_iterator nodeIt = nodes.begin();
|
for (CTNodes::const_iterator nodeIt = nodes.begin();
|
||||||
nodeIt != nodes.end(); ++ nodeIt) {
|
nodeIt != nodes.end(); ++ nodeIt) {
|
||||||
CTChilds childsCopy = (*nodeIt)->childs();
|
CTChilds childsCopy = (*nodeIt)->childs();
|
||||||
|
@ -186,7 +186,7 @@ CountingBp::createGroups (void)
|
|||||||
size_t prevVarGroupsSize = varGroups.size();
|
size_t prevVarGroupsSize = varGroups.size();
|
||||||
varGroups.clear();
|
varGroups.clear();
|
||||||
for (size_t i = 0; i < varNodes.size(); i++) {
|
for (size_t i = 0; i < varNodes.size(); i++) {
|
||||||
const VarSignature& signature = getSignature (varNodes[i]);
|
VarSignature signature = getSignature (varNodes[i]);
|
||||||
VarSignMap::iterator it = varGroups.find (signature);
|
VarSignMap::iterator it = varGroups.find (signature);
|
||||||
if (it == varGroups.end()) {
|
if (it == varGroups.end()) {
|
||||||
it = varGroups.insert (std::make_pair (
|
it = varGroups.insert (std::make_pair (
|
||||||
@ -207,7 +207,7 @@ CountingBp::createGroups (void)
|
|||||||
facGroups.clear();
|
facGroups.clear();
|
||||||
// set a new color to the factors with the same signature
|
// set a new color to the factors with the same signature
|
||||||
for (size_t i = 0; i < facNodes.size(); i++) {
|
for (size_t i = 0; i < facNodes.size(); i++) {
|
||||||
const FacSignature& signature = getSignature (facNodes[i]);
|
FacSignature signature = getSignature (facNodes[i]);
|
||||||
FacSignMap::iterator it = facGroups.find (signature);
|
FacSignMap::iterator it = facGroups.find (signature);
|
||||||
if (it == facGroups.end()) {
|
if (it == facGroups.end()) {
|
||||||
it = facGroups.insert (std::make_pair (
|
it = facGroups.insert (std::make_pair (
|
||||||
@ -270,8 +270,8 @@ CountingBp::createClusters (
|
|||||||
VarSignature
|
VarSignature
|
||||||
CountingBp::getSignature (const VarNode* varNode)
|
CountingBp::getSignature (const VarNode* varNode)
|
||||||
{
|
{
|
||||||
const FacNodes& neighs = varNode->neighbors();
|
|
||||||
VarSignature sign;
|
VarSignature sign;
|
||||||
|
const FacNodes& neighs = varNode->neighbors();
|
||||||
sign.reserve (neighs.size() + 1);
|
sign.reserve (neighs.size() + 1);
|
||||||
for (size_t i = 0; i < neighs.size(); i++) {
|
for (size_t i = 0; i < neighs.size(); i++) {
|
||||||
sign.push_back (std::make_pair (
|
sign.push_back (std::make_pair (
|
||||||
@ -288,8 +288,8 @@ CountingBp::getSignature (const VarNode* varNode)
|
|||||||
FacSignature
|
FacSignature
|
||||||
CountingBp::getSignature (const FacNode* facNode)
|
CountingBp::getSignature (const FacNode* facNode)
|
||||||
{
|
{
|
||||||
const VarNodes& neighs = facNode->neighbors();
|
|
||||||
FacSignature sign;
|
FacSignature sign;
|
||||||
|
const VarNodes& neighs = facNode->neighbors();
|
||||||
sign.reserve (neighs.size() + 1);
|
sign.reserve (neighs.size() + 1);
|
||||||
for (size_t i = 0; i < neighs.size(); i++) {
|
for (size_t i = 0; i < neighs.size(); i++) {
|
||||||
sign.push_back (getColor (neighs[i]));
|
sign.push_back (getColor (neighs[i]));
|
||||||
|
@ -44,7 +44,7 @@ createLiftedNetwork (void)
|
|||||||
while (parfactorList != YAP_TermNil()) {
|
while (parfactorList != YAP_TermNil()) {
|
||||||
YAP_Term pfTerm = YAP_HeadOfTerm (parfactorList);
|
YAP_Term pfTerm = YAP_HeadOfTerm (parfactorList);
|
||||||
parfactors.push_back (readParfactor (pfTerm));
|
parfactors.push_back (readParfactor (pfTerm));
|
||||||
parfactorList = YAP_TailOfTerm (parfactorList);
|
parfactorList = YAP_TailOfTerm (parfactorList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// LiftedUtils::printSymbolDictionary();
|
// LiftedUtils::printSymbolDictionary();
|
||||||
@ -418,7 +418,7 @@ readParfactor (YAP_Term pfTerm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read the parameters
|
// read the parameters
|
||||||
const Params& params = readParameters (YAP_ArgOfTerm (4, pfTerm));
|
Params params = readParameters (YAP_ArgOfTerm (4, pfTerm));
|
||||||
|
|
||||||
// read the constraint
|
// read the constraint
|
||||||
Tuples tuples;
|
Tuples tuples;
|
||||||
|
Reference in New Issue
Block a user