Changed Template I for compatibility w/ <complex> (see mod_README.md)
This commit is contained in:
parent
d144031940
commit
d766e6d0d7
@ -788,17 +788,17 @@ template <typename T>
|
||||
void PrintTupleTo(const T&, std::integral_constant<size_t, 0>,
|
||||
::std::ostream*) {}
|
||||
|
||||
template <typename T, size_t I>
|
||||
void PrintTupleTo(const T& t, std::integral_constant<size_t, I>,
|
||||
template <typename T, size_t __I>
|
||||
void PrintTupleTo(const T& t, std::integral_constant<size_t, __I>,
|
||||
::std::ostream* os) {
|
||||
PrintTupleTo(t, std::integral_constant<size_t, I - 1>(), os);
|
||||
PrintTupleTo(t, std::integral_constant<size_t, __I - 1>(), os);
|
||||
GTEST_INTENTIONAL_CONST_COND_PUSH_()
|
||||
if (I > 1) {
|
||||
if (__I > 1) {
|
||||
GTEST_INTENTIONAL_CONST_COND_POP_()
|
||||
*os << ", ";
|
||||
}
|
||||
UniversalPrinter<typename std::tuple_element<I - 1, T>::type>::Print(
|
||||
std::get<I - 1>(t), os);
|
||||
UniversalPrinter<typename std::tuple_element<__I - 1, T>::type>::Print(
|
||||
std::get<__I - 1>(t), os);
|
||||
}
|
||||
|
||||
template <typename... Types>
|
||||
@ -1155,14 +1155,14 @@ typedef ::std::vector<::std::string> Strings;
|
||||
template <typename Tuple>
|
||||
void TersePrintPrefixToStrings(const Tuple&, std::integral_constant<size_t, 0>,
|
||||
Strings*) {}
|
||||
template <typename Tuple, size_t I>
|
||||
template <typename Tuple, size_t __I>
|
||||
void TersePrintPrefixToStrings(const Tuple& t,
|
||||
std::integral_constant<size_t, I>,
|
||||
std::integral_constant<size_t, __I>,
|
||||
Strings* strings) {
|
||||
TersePrintPrefixToStrings(t, std::integral_constant<size_t, I - 1>(),
|
||||
TersePrintPrefixToStrings(t, std::integral_constant<size_t, __I - 1>(),
|
||||
strings);
|
||||
::std::stringstream ss;
|
||||
UniversalTersePrint(std::get<I - 1>(t), &ss);
|
||||
UniversalTersePrint(std::get<__I - 1>(t), &ss);
|
||||
strings->push_back(ss.str());
|
||||
}
|
||||
|
||||
|
@ -1144,14 +1144,14 @@ struct Ignore {
|
||||
|
||||
template <typename>
|
||||
struct ElemFromListImpl;
|
||||
template <size_t... I>
|
||||
struct ElemFromListImpl<std::index_sequence<I...>> {
|
||||
template <size_t... __I>
|
||||
struct ElemFromListImpl<std::index_sequence<__I...>> {
|
||||
// We make Ignore a template to solve a problem with MSVC.
|
||||
// A non-template Ignore would work fine with `decltype(Ignore(I))...`, but
|
||||
// MSVC doesn't understand how to deal with that pack expansion.
|
||||
// Use `0 * I` to have a single instantiation of Ignore.
|
||||
template <typename R>
|
||||
static R Apply(Ignore<0 * I>..., R (*)(), ...);
|
||||
static R Apply(Ignore<0 * __I>..., R (*)(), ...);
|
||||
};
|
||||
|
||||
template <size_t N, typename... T>
|
||||
@ -1165,12 +1165,12 @@ struct FlatTupleConstructTag {};
|
||||
template <typename... T>
|
||||
class FlatTuple;
|
||||
|
||||
template <typename Derived, size_t I>
|
||||
template <typename Derived, size_t __I>
|
||||
struct FlatTupleElemBase;
|
||||
|
||||
template <typename... T, size_t I>
|
||||
struct FlatTupleElemBase<FlatTuple<T...>, I> {
|
||||
using value_type = typename ElemFromList<I, T...>::type;
|
||||
template <typename... T, size_t __I>
|
||||
struct FlatTupleElemBase<FlatTuple<T...>, __I> {
|
||||
using value_type = typename ElemFromList<__I, T...>::type;
|
||||
FlatTupleElemBase() = default;
|
||||
template <typename Arg>
|
||||
explicit FlatTupleElemBase(FlatTupleConstructTag, Arg&& t)
|
||||
@ -1191,14 +1191,14 @@ struct FlatTupleBase<FlatTuple<T...>, std::index_sequence<Idx...>>
|
||||
: FlatTupleElemBase<FlatTuple<T...>, Idx>(FlatTupleConstructTag{},
|
||||
std::forward<Args>(args))... {}
|
||||
|
||||
template <size_t I>
|
||||
const typename ElemFromList<I, T...>::type& Get() const {
|
||||
return FlatTupleElemBase<FlatTuple<T...>, I>::value;
|
||||
template <size_t __I>
|
||||
const typename ElemFromList<__I, T...>::type& Get() const {
|
||||
return FlatTupleElemBase<FlatTuple<T...>, __I>::value;
|
||||
}
|
||||
|
||||
template <size_t I>
|
||||
typename ElemFromList<I, T...>::type& Get() {
|
||||
return FlatTupleElemBase<FlatTuple<T...>, I>::value;
|
||||
template <size_t __I>
|
||||
typename ElemFromList<__I, T...>::type& Get() {
|
||||
return FlatTupleElemBase<FlatTuple<T...>, __I>::value;
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
|
@ -811,9 +811,9 @@ class ValueArray {
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename T, size_t... I>
|
||||
std::vector<T> MakeVector(std::index_sequence<I...>) const {
|
||||
return std::vector<T>{static_cast<T>(v_.template Get<I>())...};
|
||||
template <typename T, size_t... __I>
|
||||
std::vector<T> MakeVector(std::index_sequence<__I...>) const {
|
||||
return std::vector<T>{static_cast<T>(v_.template Get<__I>())...};
|
||||
}
|
||||
|
||||
FlatTuple<Ts...> v_;
|
||||
@ -838,19 +838,19 @@ class CartesianProductGenerator
|
||||
return new Iterator(this, generators_, true);
|
||||
}
|
||||
|
||||
private:
|
||||
template <class I>
|
||||
private:
|
||||
template <class __I>
|
||||
class IteratorImpl;
|
||||
template <size_t... I>
|
||||
class IteratorImpl<std::index_sequence<I...>>
|
||||
template <size_t... __I>
|
||||
class IteratorImpl<std::index_sequence<__I...>>
|
||||
: public ParamIteratorInterface<ParamType> {
|
||||
public:
|
||||
IteratorImpl(const ParamGeneratorInterface<ParamType>* base,
|
||||
const std::tuple<ParamGenerator<T>...>& generators,
|
||||
bool is_end)
|
||||
: base_(base),
|
||||
begin_(std::get<I>(generators).begin()...),
|
||||
end_(std::get<I>(generators).end()...),
|
||||
begin_(std::get<__I>(generators).begin()...),
|
||||
end_(std::get<__I>(generators).end()...),
|
||||
current_(is_end ? end_ : begin_) {
|
||||
ComputeCurrentValue();
|
||||
}
|
||||
@ -891,8 +891,8 @@ class CartesianProductGenerator
|
||||
|
||||
bool same = true;
|
||||
bool dummy[] = {
|
||||
(same = same && std::get<I>(current_) ==
|
||||
std::get<I>(typed_other->current_))...};
|
||||
(same = same && std::get<__I>(current_) ==
|
||||
std::get<__I>(typed_other->current_))...};
|
||||
(void)dummy;
|
||||
return same;
|
||||
}
|
||||
@ -916,12 +916,12 @@ class CartesianProductGenerator
|
||||
|
||||
void ComputeCurrentValue() {
|
||||
if (!AtEnd())
|
||||
current_value_ = std::make_shared<ParamType>(*std::get<I>(current_)...);
|
||||
current_value_ = std::make_shared<ParamType>(*std::get<__I>(current_)...);
|
||||
}
|
||||
bool AtEnd() const {
|
||||
bool at_end = false;
|
||||
bool dummy[] = {
|
||||
(at_end = at_end || std::get<I>(current_) == std::get<I>(end_))...};
|
||||
(at_end = at_end || std::get<__I>(current_) == std::get<__I>(end_))...};
|
||||
(void)dummy;
|
||||
return at_end;
|
||||
}
|
||||
|
14
mod_README.md
Normal file
14
mod_README.md
Normal file
@ -0,0 +1,14 @@
|
||||
**Problem:** Gtest currently interferes w/ std::complex as complex.h uses a define for I already.
|
||||
|
||||
**Modifcation:** all **I** template names renamed to **__I** (can use whatever you want, just put a placeholder I figured wouldn’t cause interference) at following locations:
|
||||
|
||||
**include/internal/gtest-internal.h**:
|
||||
- lines 1147-1204
|
||||
|
||||
**include/gtest-printers.h**:
|
||||
- PrintTupleTo (l.791-802)
|
||||
- TersePrintPrefixToStrings (l.1159-1167)
|
||||
|
||||
**include/internal/gtest-param-util.h**:
|
||||
- MakeVector (l.814-817)
|
||||
- IteratorImpl (l.841-936)
|
Loading…
Reference in New Issue
Block a user