mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1216038 - Deduce underlying integer type for MakeEnumeratedRange starting at 0. r=froydnj
This commit is contained in:
parent
c6deb98829
commit
4fa140ec32
@ -171,6 +171,9 @@ private:
|
||||
#endif
|
||||
|
||||
// Create a range to iterate from aBegin to aEnd, exclusive.
|
||||
//
|
||||
// (Once we can rely on std::underlying_type, we can remove the IntType
|
||||
// template parameter.)
|
||||
template<typename IntType, typename EnumType>
|
||||
inline detail::EnumeratedRange<IntType, EnumType>
|
||||
MakeEnumeratedRange(EnumType aBegin, EnumType aEnd)
|
||||
@ -189,11 +192,15 @@ MakeEnumeratedRange(EnumType aBegin, EnumType aEnd)
|
||||
|
||||
// Create a range to iterate from EnumType(0) to aEnd, exclusive. EnumType(0)
|
||||
// should exist, but note that there is no way for us to ensure that it does!
|
||||
template<typename IntType, typename EnumType>
|
||||
inline detail::EnumeratedRange<IntType, EnumType>
|
||||
// Since the enumeration starts at EnumType(0), we know for sure that the values
|
||||
// will be in range of our deduced IntType.
|
||||
template<typename EnumType>
|
||||
inline detail::EnumeratedRange<UnsignedStdintTypeForSize<sizeof(EnumType)>::Type,
|
||||
EnumType>
|
||||
MakeEnumeratedRange(EnumType aEnd)
|
||||
{
|
||||
return MakeEnumeratedRange<IntType>(EnumType(0), aEnd);
|
||||
return MakeEnumeratedRange<UnsignedStdintTypeForSize<sizeof(EnumType)>::Type>(
|
||||
EnumType(0), aEnd);
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
Loading…
Reference in New Issue
Block a user