The second template argument to std::set
has to be a type, not value .
If you want to use function (which is value, not type), then you've to pass it as argument to the constructor, which means you can do this:
class Renderer
{
typedef bool (*ComparerType)(Mesh const&,Mesh const&);
std::set<Mesh, ComparerType> m_Meshes;
public:
Renderer() : m_Meshes(MeshCompare)
{ //^^^^^^^^^^^^^^^^^^^^^^^ note this
}
};
Or, define a functor class, and pass this as second type argument to std::set
.
struct MeshComparer
{
bool operator()(const Mesh& a, const Mesh& b) const
{
return ( (a.pTech < b.pTech) ||
( (b.pTech == a.pTech) && (a.pMaterial < b.pMaterial) ) ||
( (b.pTech == a.pTech) && (a.pMaterial == b.pMaterial) && (a.topology < b.topology) ) );
}
};
And then use it:
std::set<Mesh, MeshComparer> m_Meshes;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…