Is unordered_set<reference_wrapper<Ty>> valid?

Viewed 1555

Is this valid C++ (considering the latest standard)? I'm getting compilation errors with near-top-of-tree clang/libc++ on Ubuntu 12.04. If it should be valid, I'll mail the clang-dev list with error messages and such.

#include <functional>
#include <unordered_set>

struct X
{
    int i; 
};

void f ()
{
    std::unordered_set<std::reference_wrapper<X>> setOfReferencesToX;

    // Do stuff with setOfReferencesToX
}

** As an aside, I'm tired of qualifying that the question/answer is specific to the latest standard. Could the C++ community as a whole, please start qualifying things that are specific to the old standard instead? The newer standard has been out for about a year now.

1 Answers
Related