title: C++ the macro defines an empty array
body: <p>A class is implemented as follows, there are three construction methods, and then an empty sequence is declared through a macro to initialize the class,</p>
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;vector&gt;
  
  using namespace std;
  
  #define EMPTY_LIST {}
  
  class sample{
  private:
      typedef uint64_t s_type;
      vector&lt;s_type&gt; _vec;
  
  public:
    sample() {}
    sample(const sample&amp; other) : _vec(other._vec) {{
        cout &lt;&lt; &quot;const lvalue&quot; &lt;&lt; endl;      
    }}
    sample(sample&amp;&amp; other) : _vec(std::move(other._vec)) {{
        cout &lt;&lt; &quot;rvalue ref&quot; &lt;&lt; endl;      
    }}
    sample(const vector&lt;size_t&gt;&amp; array) {
        cout &lt;&lt; &quot;array&quot; &lt;&lt; endl;      
    };
  };
  
  
  int main(){
      sample ft(EMPTY_LIST);
      return 0;
  }
  </code></pre>
  <p>But the compilation reports an error. What is the reason?</p>
  <pre class="lang-sh prettyprint-override"><code># g++ sample.cc -o sample
  sample.cc: In function ‘int main()’:
  sample.cc:30:25: error: call of overloaded ‘sample(&lt;brace-enclosed initializer list&gt;)’ is ambiguous
       sample ft(EMPTY_LIST);
                           ^
  sample.cc:22:3: note: candidate: ‘sample::sample(const std::vector&lt;long unsigned int&gt;&amp;)’
     sample(const vector&lt;size_t&gt;&amp; array) {
     ^~~~~~
  sample.cc:19:3: note: candidate: ‘sample::sample(sample&amp;&amp;)’
     sample(sample&amp;&amp; other) : _vec(std::move(other._vec)) {{
     ^~~~~~
  sample.cc:16:3: note: candidate: ‘sample::sample(const sample&amp;)’
     sample(const sample&amp; other) : _vec(other._vec) {{
     ^~~~~~
  </code></pre>
  <p>maybe the empty array defined by the macro is an empty instance? So is it ambiguous? Or is it because of the C++ standard?</p>