Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73614 - in sandbox/coerce/boost/coerce: . detail
From: vexocide_at_[hidden]
Date: 2011-08-08 15:56:47


Author: vexocide
Date: 2011-08-08 15:56:45 EDT (Mon, 08 Aug 2011)
New Revision: 73614
URL: http://svn.boost.org/trac/boost/changeset/73614

Log:
Explicitly check if the type is a tag
Added:
   sandbox/coerce/boost/coerce/detail/tag.hpp (contents, props changed)
Text files modified:
   sandbox/coerce/boost/coerce/coerce.hpp | 6 +++---
   1 files changed, 3 insertions(+), 3 deletions(-)

Modified: sandbox/coerce/boost/coerce/coerce.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/coerce.hpp (original)
+++ sandbox/coerce/boost/coerce/coerce.hpp 2011-08-08 15:56:45 EDT (Mon, 08 Aug 2011)
@@ -12,12 +12,12 @@
 #endif
 
 #include <boost/coerce/detail/backend.hpp>
+#include <boost/coerce/detail/tag.hpp>
 #include <boost/coerce/sequence.hpp>
 #include <boost/coerce/string.hpp>
 #include <boost/coerce/tag.hpp>
 
 #include <boost/throw_exception.hpp>
-#include <boost/type_traits/is_same.hpp>
 #include <boost/utility/enable_if.hpp>
 
 #include <typeinfo> // for std::bad_cast
@@ -67,8 +67,8 @@
     }
 
     template <typename Target, typename Source, typename Tag>
- inline typename disable_if<
- is_same<Target, Tag>, Target>::type
+ inline typename enable_if<
+ detail::is_tag<Tag>, Target>::type
     as_default(
         Source const & source,
         Tag const & tag,

Added: sandbox/coerce/boost/coerce/detail/tag.hpp
==============================================================================
--- (empty file)
+++ sandbox/coerce/boost/coerce/detail/tag.hpp 2011-08-08 15:56:45 EDT (Mon, 08 Aug 2011)
@@ -0,0 +1,31 @@
+// Copyright Jeroen Habraken 2011.
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file ../../../LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_COERCE_DETAIL_TAG_HPP
+#define BOOST_COERCE_DETAIL_TAG_HPP
+
+#ifdef _MSC_VER
+#pragma once
+#endif
+
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/or.hpp>
+
+namespace boost { namespace coerce { namespace detail {
+
+ BOOST_MPL_HAS_XXX_TEMPLATE_DEF(parser)
+ BOOST_MPL_HAS_XXX_TEMPLATE_DEF(generator)
+
+ template <typename T>
+ struct is_tag
+ : mpl::or_<
+ has_parser<T>,
+ has_generator<T>
+ > { };
+
+} } } // namespace boost::coerce::detail
+
+#endif // BOOST_COERCE_DETAIL_TAG_HPP


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk