summaryrefslogtreecommitdiff
path: root/src/sexpr/variant.hpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-06-27 19:16:45 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-06-27 19:33:42 -0700
commit7af4c5b5c561362cb1135ab504095ae667a9270a (patch)
tree49ffd3008d7634ba36f3951493a68e928407ce89 /src/sexpr/variant.hpp
parent8d7f1dadeeb1dc1609b72de5a4ee3a5247b0e9e6 (diff)
downloadtmwa-7af4c5b5c561362cb1135ab504095ae667a9270a.tar.gz
tmwa-7af4c5b5c561362cb1135ab504095ae667a9270a.tar.bz2
tmwa-7af4c5b5c561362cb1135ab504095ae667a9270a.tar.xz
tmwa-7af4c5b5c561362cb1135ab504095ae667a9270a.zip
This is more reliable
Diffstat (limited to 'src/sexpr/variant.hpp')
-rw-r--r--src/sexpr/variant.hpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/sexpr/variant.hpp b/src/sexpr/variant.hpp
index ccbfeaa..04f35dc 100644
--- a/src/sexpr/variant.hpp
+++ b/src/sexpr/variant.hpp
@@ -1,5 +1,4 @@
-#ifndef TMWA_SEXPR_VARIANT_HPP
-#define TMWA_SEXPR_VARIANT_HPP
+#pragma once
// variant.hpp - A single value, multiple type container. Better than boost's.
//
// Copyright © 2012 Ben Longbons <b.r.longbons@gmail.com>
@@ -19,30 +18,30 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-# include <type_traits>
-# include <cstdint>
-# include <cstddef>
-# include <utility>
+#include <type_traits>
+#include <cstdint>
+#include <cstddef>
+#include <utility>
-# include "union.hpp"
-# include "void.hpp"
+#include "union.hpp"
+#include "void.hpp"
-# include "fwd.hpp"
+#include "fwd.hpp"
namespace tmwa
{
namespace sexpr
{
-# define JOIN(a, b) a##b
+#define JOIN(a, b) a##b
-# define WITH_VAR(ty, var, expr) \
+#define WITH_VAR(ty, var, expr) \
for (bool JOIN(var, _guard) = true; JOIN(var, _guard); ) \
for (ty var = expr; JOIN(var, _guard); JOIN(var, _guard) = false)
-# define MATCH(expr) \
+#define MATCH(expr) \
WITH_VAR(auto&&, _match_var, expr) \
switch (tmwa::sexpr::VariantFriend::get_state(_match_var))
-# define CASE(ty, var) \
+#define CASE(ty, var) \
break; \
case tmwa::sexpr::VariantFriend::get_state_for<ty, decltype(_match_var)>(): \
WITH_VAR(ty, var, tmwa::sexpr::VariantFriend::unchecked_get<ty>(_match_var))
@@ -114,6 +113,4 @@ namespace sexpr
} // namespace sexpr
} // namespace tmwa
-# include "variant.tcc"
-
-#endif //TMWA_SEXPR_VARIANT_HPP
+#include "variant.tcc"