Don't extend explicity the life time of returned temporaries.

That sort of optimization is compiler's work.
This commit is contained in:
Tiago Gomes 2013-02-16 18:58:22 +00:00
parent ea49b517e8
commit b6ee7b4460
3 changed files with 7 additions and 7 deletions

View File

@ -1033,7 +1033,7 @@ ConstraintTree::swapLogVar (LogVar X)
{
size_t pos = Util::indexOf (logVars_, X);
assert (pos != logVars_.size());
const CTNodes& nodes = getNodesAtLevel (pos);
CTNodes nodes = getNodesAtLevel (pos);
for (CTNodes::const_iterator nodeIt = nodes.begin();
nodeIt != nodes.end(); ++ nodeIt) {
CTChilds childsCopy = (*nodeIt)->childs();

View File

@ -186,7 +186,7 @@ CountingBp::createGroups (void)
size_t prevVarGroupsSize = varGroups.size();
varGroups.clear();
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);
if (it == varGroups.end()) {
it = varGroups.insert (std::make_pair (
@ -207,7 +207,7 @@ CountingBp::createGroups (void)
facGroups.clear();
// set a new color to the factors with the same signature
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);
if (it == facGroups.end()) {
it = facGroups.insert (std::make_pair (
@ -270,8 +270,8 @@ CountingBp::createClusters (
VarSignature
CountingBp::getSignature (const VarNode* varNode)
{
const FacNodes& neighs = varNode->neighbors();
VarSignature sign;
const FacNodes& neighs = varNode->neighbors();
sign.reserve (neighs.size() + 1);
for (size_t i = 0; i < neighs.size(); i++) {
sign.push_back (std::make_pair (
@ -288,8 +288,8 @@ CountingBp::getSignature (const VarNode* varNode)
FacSignature
CountingBp::getSignature (const FacNode* facNode)
{
const VarNodes& neighs = facNode->neighbors();
FacSignature sign;
const VarNodes& neighs = facNode->neighbors();
sign.reserve (neighs.size() + 1);
for (size_t i = 0; i < neighs.size(); i++) {
sign.push_back (getColor (neighs[i]));

View File

@ -418,7 +418,7 @@ readParfactor (YAP_Term pfTerm)
}
// read the parameters
const Params& params = readParameters (YAP_ArgOfTerm (4, pfTerm));
Params params = readParameters (YAP_ArgOfTerm (4, pfTerm));
// read the constraint
Tuples tuples;