title: Why do user-defined string literals and integer literals have different behavior?
body: <p>I'm learning about user-defined literals, and confused with the following test code:</p>
  
  <pre><code>std::chrono::seconds operator"" _s(unsigned long long s) {
      return std::chrono::seconds(s);
  }
  
  std::string operator"" _str(const char *s, std::size_t len) {
      return std::string(s, len);
  }
  
  int main() {
      auto str = "xxxxx"_str;
      std::cout &lt;&lt; str.size() &lt;&lt; std::endl;    // works
  
      auto sec = 4_s;
      std::cout &lt;&lt; sec.count() &lt;&lt; std::endl;   // works
  
      std::cout &lt;&lt; "xxxxx"_str.size() &lt;&lt; std::endl;   // works
  
      std::cout &lt;&lt; 4_s.count() &lt;&lt; std::endl;   // does **NOT** work!
  
      return 0;
  }
  </code></pre>
  
  <p>The compiler gives the following error message: </p>
  
  <blockquote>
    <p>error: no matching literal operator for call to 'operator""_s.count' with argument of type 'unsigned long long' or 'const char *', and no matching literal operator template<br>
         cout &lt;&lt; 4_s.count() &lt;&lt; endl;</p>
  </blockquote>
  
  <p>It seems that it takes <strong><em>_s.count</em></strong> as a user-defined literal. Also, a floating-point literal behaves like an integer literal.</p>
  
  <p>Why do user-defined integer literals and string literals have different behavior?</p>