title: Why can't I return a normal map reference with a transparent functor?
body: <p>This code works:</p>
  
  <pre><code>class MyObj {};
  
  class MyData {
   public:
    using tMyMap = std::map&lt;uint64_t, std::shared_ptr&lt;MyObj&gt;&gt;;
  
    const tMyMap&amp; get_normal() const;
    const tMyMap&amp; get_reverse() const;
  
   private:
    std::map&lt;uint64_t, std::shared_ptr&lt;MyObj&gt;&gt; _normal;
  
    std::map&lt;uint64_t, std::shared_ptr&lt;MyObj&gt;, std::less&lt;uint64_t&gt;&gt; _reverse;
  };
  
  const MyData::tMyMap&amp; get_normal() const { return _normal; }
  const MyData::tMyMap&amp; get_reverse() const { return _reverse; }
  </code></pre>
  
  <p>But clang-tidy recommends that I use a transparent functor and change <code>std::less&lt;uint64_t&gt;</code> to <code>std::less&lt;&gt;</code> in my declaration of <code>_reverse</code>. Unfortunately, when I do that, the code doesn't compile anymore:</p>
  
  <pre><code>test_map.cpp: In member function ‘const tMyMap&amp; MyData::get_reverse() const’:
  test_map.cpp:20:60: error: invalid initialization of reference of type ‘const tMyMap&amp; {aka const std::map&lt;long unsigned int, std::shared_ptr&lt;MyObj&gt; &gt;&amp;}’ from expression of type ‘const std::map&lt;long unsigned int, std::shared_ptr&lt;MyObj&gt;, std::less&lt;void&gt; &gt;’
   const MyData::tMyMap&amp; MyData::get_reverse() const { return _reverse; }
  </code></pre>
  
  <p>That error message is from g++, but clang gives me a similar error.</p>
  
  <p>Why is the typed functor okay, but the transparent functor doesn't compile?</p>