title: What is Foo(int* ptr): ptr_{ptr}{}?
body: <p>I saw this code in the book &quot;C++ High Performance&quot; by Bjorn Andrist and Viktor Sehr.
  The code example is actually used to show the point that &quot;Compiles despite function being declared <code>const</code>!&quot;, and I am aware of this. However, I have not seen <code>int* ptr_{};</code> and <code>Foo(int* ptr):ptr_{ptr}{}</code> before this point. What are these two pieces of code doing, especifically <code>Foo(int* ptr):ptr_{ptr}{}</code>?
  The entire code snippet used as an example was this:</p>
  <pre><code>class Foo {
  public:
      Foo(int* ptr):ptr_{ptr}{}
      auto set_ptr_val(int v) const {
          *ptr_ = v; // Compiles despite function being declared const!
      }
  
  private:
      int* ptr_{};
  };
  
  int main(){
      auto i = 0;
      const auto foo = Foo{&amp;i};
      foo.set_ptr_val(42);
  }
  
  </code></pre>