Simplistic enable_if SFINAE helper implementation

This commit is contained in:
Danny Robson 2011-07-05 22:52:32 +10:00
parent 4fb7b8e30f
commit d3c98d479e
2 changed files with 34 additions and 0 deletions

View File

@ -10,6 +10,7 @@ UTIL_INCLUDE = \
annotations.hpp \
backtrace.hpp \
debug.hpp \
enable_if.hpp \
except.hpp \
float.hpp \
io.hpp \

33
enable_if.hpp Normal file
View File

@ -0,0 +1,33 @@
/*
* This file is part of libgim.
*
* Waif is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* Waif is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with libgim. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2010 Danny Robson <danny@blubinc.net>
*/
#ifndef __ENABLE_IF_HPP
#define __ENABLE_IF_HPP
template <bool B, typename T>
struct enable_if {
typedef T type;
};
template <typename T>
struct enable_if<false, T> { };
#endif // __ENABLE_IF_HPP