Generic unique pointers : <p>Below is my sample code:</p>

<pre><code>#include &lt;functional&gt;
#include &lt;iostream&gt;
#include &lt;memory&gt;
using namespace std::placeholders;

template &lt;typename recvtype, typename responsetype&gt;
void myfunc(std::unique_ptr&lt;recvtype&gt; input, std::function&lt;void(std::unique_ptr&lt;responsetype&gt;)&gt; callback)
{
        auto msg = std::make_unique&lt;responsetype&gt;();
        callback(std::move(msg));
    return;
}

class Ret
{
public:
Ret(){}
void BRet(std::unique_ptr&lt;Ret&gt; r)
{
std::cout &lt;&lt; "Called Me!!!" &lt;&lt; std::endl &lt;&lt; std::fflush;
}

};

class In
{
public:
In(){}
};

void test(std::unique_ptr&lt;In&gt; input, std::function&lt;void(std::unique_ptr&lt;Ret&gt;)&gt; callback)
{
myfunc&lt;In , Ret&gt;(std::move(input), callback);
}

int main()
{
std::unique_ptr&lt;In&gt; a = std::make_unique&lt;In&gt;();
Ret r1;
std::function&lt;void(std::unique_ptr&lt;Ret&gt;)&gt; f = std::bind(&amp;Ret::BRet, &amp;r1, _1);
test(std::move(a),f);
}
</code></pre>

<p>When I compile and execute the code I get below output:</p>

<pre><code>$ c++ --std=c++14 -g try17.cpp

MINGW64 /c/test
$ ./a.exe
Called Me!!!
1
MINGW64 /c/test
$
</code></pre>

<p>I am not sure from where the <strong>'1'</strong> getting printed on console and how can I make <strong>test</strong> to accept generic unique pointers - I mean test method can now be called for any type instead of <strong>'In and Ret'</strong> types?</p>
