Skip to content

Commit a589d7c

Browse files
committed
Ternary operator in custom map operator
1 parent 4ecee18 commit a589d7c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Diff for: CodeWars/src/UpsideDownNumbers/Solution1.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ struct RotationMap
1414

1515
int operator [](int digit)
1616
{
17-
if (hashMap.find(digit) != std::end(hashMap))
18-
return hashMap[digit];
19-
else
20-
return -1;
17+
return hashMap.find(digit) != std::end(hashMap) ? hashMap[digit] : -1;
2118
}
2219

2320
};

0 commit comments

Comments
 (0)