source: trunk/GDE/SINA/builddir/src/helpers.h

Last change on this file was 19170, checked in by westram, 2 years ago
  • sina source
    • unpack + remove tarball
    • no longer ignore sina builddir.
File size: 407 bytes
Line 
1#ifndef _HELPERS_H_
2#define _HELPERS_H_
3
4#define unlikely(x) (__builtin_expect ((x), 0))
5#define likely(x) (__builtin_expect ((x), 1))
6
7#include <iostream>
8template<class T>
9auto operator<<(std::ostream& out, const T& t) -> decltype(t.print_to(out)) {
10  // auto f()->decltype() used so that template only applies to
11  // things with proper print_to method
12  return t.print_to(out);
13}
14
15#endif // _HELPERS_H_
Note: See TracBrowser for help on using the repository browser.