Differential D3094 Diff 14018 ps/trunk/libraries/source/spidermonkey/include-win32-debug/mozilla/Tuple.h
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/libraries/source/spidermonkey/include-win32-debug/mozilla/Tuple.h
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | |||||
template<std::size_t Index, typename... Elements> | template<std::size_t Index, typename... Elements> | ||||
struct TupleImpl; | struct TupleImpl; | ||||
/* | /* | ||||
* The base case of the inheritance recursion (and also the implementation | * The base case of the inheritance recursion (and also the implementation | ||||
* of an empty tuple). | * of an empty tuple). | ||||
*/ | */ | ||||
template<std::size_t Index> | template<std::size_t Index> | ||||
struct TupleImpl<Index> {}; | struct TupleImpl<Index> { | ||||
bool operator==(const TupleImpl<Index>& aOther) const | |||||
{ | |||||
return true; | |||||
} | |||||
}; | |||||
/* | /* | ||||
* One node of the recursive inheritance hierarchy. It stores the element at | * One node of the recursive inheritance hierarchy. It stores the element at | ||||
* index 'Index' of a tuple, of type 'HeadT', and inherits from the nodes | * index 'Index' of a tuple, of type 'HeadT', and inherits from the nodes | ||||
* that store the remaining elements, of types 'TailT...'. | * that store the remaining elements, of types 'TailT...'. | ||||
*/ | */ | ||||
template<std::size_t Index, typename HeadT, typename... TailT> | template<std::size_t Index, typename HeadT, typename... TailT> | ||||
struct TupleImpl<Index, HeadT, TailT...> | struct TupleImpl<Index, HeadT, TailT...> | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | TupleImpl& operator=(const TupleImpl& aOther) | ||||
return *this; | return *this; | ||||
} | } | ||||
TupleImpl& operator=(TupleImpl&& aOther) | TupleImpl& operator=(TupleImpl&& aOther) | ||||
{ | { | ||||
Head(*this) = Move(Head(aOther)); | Head(*this) = Move(Head(aOther)); | ||||
Tail(*this) = Move(Tail(aOther)); | Tail(*this) = Move(Tail(aOther)); | ||||
return *this; | return *this; | ||||
} | } | ||||
bool operator==(const TupleImpl& aOther) const | |||||
{ | |||||
return Head(*this) == Head(aOther) && Tail(*this) == Tail(aOther); | |||||
} | |||||
private: | private: | ||||
HeadT mHead; // The element stored at this index in the tuple. | HeadT mHead; // The element stored at this index in the tuple. | ||||
}; | }; | ||||
} // namespace detail | } // namespace detail | ||||
/** | /** | ||||
* Tuple is a class that stores zero or more objects, whose types are specified | * Tuple is a class that stores zero or more objects, whose types are specified | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | Tuple& operator=(const Tuple& aOther) | ||||
static_cast<Impl&>(*this) = aOther; | static_cast<Impl&>(*this) = aOther; | ||||
return *this; | return *this; | ||||
} | } | ||||
Tuple& operator=(Tuple&& aOther) | Tuple& operator=(Tuple&& aOther) | ||||
{ | { | ||||
static_cast<Impl&>(*this) = Move(aOther); | static_cast<Impl&>(*this) = Move(aOther); | ||||
return *this; | return *this; | ||||
} | } | ||||
bool operator==(const Tuple& aOther) const | |||||
{ | |||||
return static_cast<const Impl&>(*this) == static_cast<const Impl&>(aOther); | |||||
} | |||||
}; | }; | ||||
/** | /** | ||||
* Specialization of Tuple for two elements. | * Specialization of Tuple for two elements. | ||||
* This is created to support construction and assignment from a Pair or std::pair. | * This is created to support construction and assignment from a Pair or std::pair. | ||||
*/ | */ | ||||
template <typename A, typename B> | template <typename A, typename B> | ||||
class Tuple<A, B> : public detail::TupleImpl<0, A, B> | class Tuple<A, B> : public detail::TupleImpl<0, A, B> | ||||
▲ Show 20 Lines • Show All 192 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator