//#####################################################################
// Copyright 2021.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################

#include <cstdio>
#include <functional>

/*
  The goal of this exercise is to create a sorted extended idea of a function
  pointer.  (That is, we will implement the std::function class).  The idea is
  to create a class that is capable of storing anything that looks like a
  function with some signature, whether it is a function, a lambda, or a class
  that defines the function call operator.  If you have implemented it
  correctly, you should be able to uncomment the code in the main function and
  have it function as one would expect.
 */

template<class FUNC> class func_holder;

template<class R,class... Args>
class func_holder<R(Args...)>
{
    // TODO
};

int func(int a,int b){return a+b;}

struct A
{
    int operator()(int a,int b) const {return a-b;}
};

int main(int argc, char* argv[])
{
/*  // These lines should function appropriately.

    func_holder<int(int,int)> fh=func;

    printf("%i\n",fh(2,3)); // 5

    fh=[argc](int a,int b){return a*b+argc;};

    printf("%i\n",fh(2,3)); // 7

    fh=A();

    printf("%i\n",fh(2,3)); // -1
*/
    
    return 0;
}

