title: C++ Concepts for checking if a function exists in a container class and implicit deduction rules
body: <p>I'm trying to figure out how to do a few things that seem to be tricky to me with regards to concepts and template type like std::vector.</p>
  
  <ol>
  <li><p>I am trying to apply a compile time constraint similar to how I used std::movable on T, but on C with PushBackMovable. It works with the requires at the tail end of the function decl, but I would like to be consistent and put my constraints within the template args. I tried replacing "class C" with "PushBackMovable C", but that not so epically failed, but is closer to what I would prefer. </p></li>
  <li><p>I'm trying to use the template types within the templated template parameter.<br>
  2a. Is there any way to just declare C and use the template args within it inside the signature of the
     function? For example, can I remove "T" and "Alloc", and ride with "_T" and "_Alloc"? It seems 
     that I cannot access those parameters. I want to save some code space.<br>
  2b. Is their a way to remove the empty &lt;> on C on the first arg of the operator?<br>
  2c. The compiler can deduce the template types of C on the requires if I just had PushBackMovable, 
     but then declval barfs. Are their any tricks I"m missing to implicitly determine template 
     parameters, specifically on the "C" instances? It would be nice to just say "C".<br></p></li>
  <li>Is their an easier way to check for existence of a method than below? </li>
  </ol>
  
  <p>Here is my example code for both cases:</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;type_traits&gt;
  #include &lt;algorithm&gt;
  
  template&lt;typename T, typename Alloc, template&lt;typename _T=T, typename _Alloc=Alloc&gt; class C &gt;
  concept PushBackMovable = std::is_same_v&lt;decltype(std::declval&lt;C&lt;T,Alloc&gt; &gt;().push_back(std::move(T{}))),void&gt; &amp;&amp;
                            std::is_same_v&lt;decltype(std::declval&lt;C&lt;T,Alloc&gt; &gt;().push_back(T{})),void&gt;; 
  
  template&lt;std::movable T, typename Alloc, template&lt;typename _T=T, typename _Alloc=Alloc&gt; class C &gt; 
  void operator+=( C&lt;&gt;&amp; lhs, T rhs ) requires PushBackMovable&lt;T, Alloc, C&gt;
  {
    lhs.push_back( std::forward&lt;T&gt;( rhs ) );
  }
  
  int main() {
    std::vector&lt;int&gt; ints;
    int a = 5;
  
    ints += 1;
    ints += a;
  
    std::copy(std::begin(ints), std::end(ints), std::ostream_iterator&lt;int&gt;(std::cout, " "));
  }
  </code></pre>
  
  <p>Thank you for your help.</p>