Hey guys,

I'm wondering if anyone here knows why Material's operator& is private.

This is preventing me from doing something like this:

struct Material_less
{
bool operator() (const Material& lhs, const Material& rhs) const
{
return lhs.GetObjectID() < rhs.GetObjectID();
}
}

void SortMyMaterialsByObjectId(std::vector<Material>& materials)
{
std::sort( materials.begin(), materials.end(), Material_less() );
}

I can get around this by wrapping Material inside a struct like so:

struct _Material
{
explicit _Material(const CRef& rhs) : m(rhs) { }
 Material m;
};

and modifying the code above to use _Material instead of Material, but I'm
worried that there's a good reason not to take the address of a Material.
Anyone know such a reason?

Thanks,

-Nicolas

Reply via email to