Skip to main content
Code Review

Return to Answer

Commonmark migration
Source Link

##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?

Fixed typos
Source Link
Toby Speight
  • 87.3k
  • 14
  • 104
  • 322
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:

added 397 characters in body
Source Link
Loki Astari
  • 97.7k
  • 5
  • 126
  • 341

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?

added 337 characters in body
Source Link
Loki Astari
  • 97.7k
  • 5
  • 126
  • 341
Loading
Source Link
Loki Astari
  • 97.7k
  • 5
  • 126
  • 341
Loading
lang-cpp

AltStyle によって変換されたページ (->オリジナル) /