TypeOrdering.h revision 2b9d973eb749aee6becbcf5e51ab5d49b828c978
1//===-------------- TypeOrdering.h - Total ordering for types -------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file provides a function object that gives a total ordering 11// on QualType values, so that they can be sorted, used in std::maps 12// and std::sets, and so on. 13// 14//===----------------------------------------------------------------------===// 15 16#ifndef LLVM_CLANG_TYPE_ORDERING_H 17#define LLVM_CLANG_TYPE_ORDERING_H 18 19#include "clang/AST/Type.h" 20#include <functional> 21 22namespace clang { 23 24/// QualTypeOrdering - Function object that provides a total ordering 25/// on QualType values. 26struct QualTypeOrdering : std::binary_function<QualType, QualType, bool> { 27 bool operator()(QualType T1, QualType T2) const { 28 return std::less<void*>()(T1.getAsOpaquePtr(), T2.getAsOpaquePtr()); 29 } 30}; 31 32} 33 34#endif 35