00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00027
#ifndef SHUTILITY_HPP
00028
#define SHUTILITY_HPP
00029
00034
#include <iosfwd>
00035
#include "ShDllExport.hpp"
00036
00037
namespace SH {
00038
00040 SH_DLLEXPORT
00041 std::ostream&
shPrintIndent(std::ostream& out,
int indent);
00042
00046 template<
bool B>
struct ShCompileTimeChecker
00047 {
00048
ShCompileTimeChecker(...);
00049 };
00050
template<>
struct ShCompileTimeChecker<false> {
00051 };
00052
00053
#define SH_STATIC_CHECK(expr, msg) \
00054
{ \
00055
class SH_ERROR_##msg {} y; \
00056
(void)sizeof(ShCompileTimeChecker<(expr)>(y));\
00057
}
00058
00059
struct
00060
SH_DLLEXPORT ShIgnore {
00061
template<
typename T>
00062 T&
operator&(T& other) {
return other; }
00063 };
00064
00066
template<
bool B,
typename T1,
typename T2>
00067
struct SelectType;
00068
00069
template<
typename T1,
typename T2>
00070
struct SelectType<true, T1, T2> {
00071
typedef T1 type;
00072 };
00073
00074
template<
typename T1,
typename T2>
00075
struct SelectType<false, T1, T2> {
00076
typedef T2 type;
00077 };
00078
00079 }
00080
00081
#endif