##Overview
Overview
Code Review
##Code Review WhyWhy is this a function?
##Overview
##Code Review Why is this a function?
Overview
Code Review
Why is this a function?
if (!book.is_open()) {
throw std::runtime_errirruntime_error("Unable to open file");
}
You are definatelydefinitely going in the corretcorrect direction here. But you need to fix a couple of bugs here:
if (!book.is_open()) {
throw std::runtime_errir("Unable to open file");
}
You are definately going in the corret direction here. But you need to fix a couple of bugs here:
if (!book.is_open()) {
throw std::runtime_error("Unable to open file");
}
You are definitely going in the correct direction here. But you need to fix a couple of bugs here:
I don't mention it in the code below. But when passing object you usally pass by const reference. This will avoid unneeded copies being created. You pass the strings around by value which cause a copy of the string to be created with each function call (that's expensive).
If you re-write to include all the above advice we can discuss the opportunities that come with using move semantics.
##Code Review Why is this a function?
##Code Review Why is this a function?
I don't mention it in the code below. But when passing object you usally pass by const reference. This will avoid unneeded copies being created. You pass the strings around by value which cause a copy of the string to be created with each function call (that's expensive).
If you re-write to include all the above advice we can discuss the opportunities that come with using move semantics.
##Code Review Why is this a function?