title: How can I use member function without creating instance of class, using std::function?
body: <p>I am looking for a way of calling member function without creating instance of class, and I don't mean static function.</p>
  
  <p>Here's the situation:</p>
  
  <pre><code>//Texture.cpp
  #include "Window.hpp"//Window included
  void Texture::Init(const char* path, const Window&amp;)
  {
    loadTexture(path, Window.getRenderer();
  }
  
  void Texture::loadTexture(const char* path, SDL_Renderer* renderer)
  {
    //code...
  }
  </code></pre>
  
  <p>Window has a member function SDL_Renderer* getRenderer(). However, I can't use it in this situation, because there is no instance of Window created.</p>
  
  <p>I came across <a href="https://stackoverflow.com/questions/14189440/c-class-member-callback-simple-examples">this question</a>, and if I had to find a way by myself, I would do the same thing as the guy did: creating static function. However, this looks like going around a problem for me. The answer with using std::function and std::bind looked good to me, but I can't figure out how to use it. Could anyone help me please? </p>
  
  <p>I have:</p>
  
  <ul>
  <li>function loadTexture, taking const char* and SDL_Renderer* as arguments, and returning void</li>
  <li>function Init, taking const char* and const Window&amp; as arguments, and returning void</li>
  <li>class Window, which has function getRenderer, taking no arguments and returning SDL_Renderer*</li>
  </ul>
  
  <p>Could anybody help me please, with explanation, so I could do the same thing by myself next time I encounter this problem?</p>
  
  <p>Thanks in advance.</p>