#include <cstdio>
#include <cstdarg>
#include <functional>

class PrintWrapper
{
    
    public:
    PrintWrapper()  = default;

    
    template<typename T>
    PrintWrapper( T&& t)  : func(std::forward<T>(t))
    {
        
    }
    
    
    int operator()(char const* format, ...)
    {
        va_list args;
        va_start(args, format);
        int result = func(format, args);
        va_end(args);
        return result;
    }
    private:
    
    std::function< int(char const*, va_list)> func;
    
};

int main()
{
    // Note, you have to use the 'v' versions
    PrintWrapper p = std::vprintf;
    p("%d %d %s\n", 1,2, "hello");
    char buffer[256];
    using namespace std::placeholders;
    p = std::bind(std::vsnprintf, buffer, sizeof(buffer), _1, _2 );
    
    p("%lf %s\n", 0.1234, "goodbye");
    
    // Since the previous step was a wrapper around snprintf, we need to print
    // the buffer it wrote into
    printf("%s\n", buffer);
    
    return 0;
}