Why can't inline functions see inside scopes?
<p>I understand that inline functions are functions whose bodies are inserted into the place at which they are called. Then why therefore aren't inline functions affected by scope changes when they are invoked:</p>

<pre><code>#include &lt;iostream&gt;

inline void alert(const std::string &amp;str) { cout &lt;&lt; str; }

int main() {
    using namespace std;

    alert("Hello World"); // cout &lt;&lt; "Hello World";
}
</code></pre>

<p>This doesn't work because I get the error <code>cout was not declared in this scope</code>, but if I do <code>std::cout</code> it does. Why doesn't C++ know that <code>cout</code> is a member of <code>std</code> if the function body of inline functions are inserted into the scope?</p>
