Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
testing_internal Namespace Reference

Functions

template<typename T >
void DefaultPrintNonContainerTo (const T &value, ::std::ostream *os)
 

Function Documentation

◆ DefaultPrintNonContainerTo()

template<typename T >
void testing_internal::DefaultPrintNonContainerTo ( const T & value,
::std::ostream * os )

Definition at line 258 of file gtest-printers.h.

258 {
259 // With the following statement, during unqualified name lookup,
260 // testing::internal2::operator<< appears as if it was declared in
261 // the nearest enclosing namespace that contains both
262 // ::testing_internal and ::testing::internal2, i.e. the global
263 // namespace. For more details, refer to the C++ Standard section
264 // 7.3.4-1 [namespace.udir]. This allows us to fall back onto
265 // testing::internal2::operator<< in case T doesn't come with a <<
266 // operator.
267 //
268 // We cannot write 'using ::testing::internal2::operator<<;', which
269 // gcc 3.3 fails to compile due to a compiler bug.
270 using namespace ::testing::internal2; // NOLINT
271
272 // Assuming T is defined in namespace foo, in the next statement,
273 // the compiler will consider all of:
274 //
275 // 1. foo::operator<< (thanks to Koenig look-up),
276 // 2. ::operator<< (as the current namespace is enclosed in ::),
277 // 3. testing::internal2::operator<< (thanks to the using statement above).
278 //
279 // The operator<< whose type matches T best will be picked.
280 //
281 // We deliberately allow #2 to be a candidate, as sometimes it's
282 // impossible to define #1 (e.g. when foo is ::std, defining
283 // anything in it is undefined behavior unless you are a compiler
284 // vendor.).
285 *os << value;
286}
os_t os
#define value
Definition pkcs11.h:157
Here is the caller graph for this function: