If the following method

```
template<typename... Args>
void report(std::ostream&str, Args&&... args)
{
    (str << ... << args);
}

```

is called synchronously from different threads with the same `str`, the write from different threads may be mangled. Therefore, I use instead

```
template<typename... Args>
void report(std::ostream&str, Args&&... args)
{
    std::ostringstream ostr;
    (ostr << ... << args);
    str << ostr.str();
}

```

Now, I wonder whether instead it would be possible to detect whether this is indeed necessary, i.e.

```
{
    if(is_global_object(str)) {      // how to implement this?
        std::ostringstream ostr;
        (ostr << ... << args);
        str << ostr.str();
    } else
        (str << ... << args);
}

```

Question: how to implement `is_global_object(str)`? I would be happy to detect all of `std::cout`, `std::wcout`, `std::clog`, `std::wclog`, `std::cerr`, `std::wcerr`.