From 9bcae0867fa975fe924c34d043c7971f71189d9d Mon Sep 17 00:00:00 2001 From: rbock Date: Wed, 29 Jan 2014 14:28:07 +0100 Subject: [PATCH] Moved "wrong" template to namespace vendor --- include/sqlpp11/column.h | 2 +- include/sqlpp11/detail/set.h | 12 +++++------ include/sqlpp11/multi_column.h | 2 +- include/sqlpp11/parameter_list.h | 4 ++-- include/sqlpp11/select.h | 2 +- include/sqlpp11/tvin.h | 2 +- include/sqlpp11/vendor/expression.h | 12 +++++------ include/sqlpp11/vendor/expression_fwd.h | 16 +++++++------- include/sqlpp11/vendor/interpreter.h | 4 ++-- include/sqlpp11/vendor/select_column_list.h | 2 +- include/sqlpp11/vendor/select_flag_list.h | 2 +- include/sqlpp11/vendor/wrap_operand.h | 8 +++---- include/sqlpp11/{detail => vendor}/wrong.h | 24 +++++++++++++++------ 13 files changed, 51 insertions(+), 41 deletions(-) rename include/sqlpp11/{detail => vendor}/wrong.h (76%) diff --git a/include/sqlpp11/column.h b/include/sqlpp11/column.h index 98f31ae7..056be19f 100644 --- a/include/sqlpp11/column.h +++ b/include/sqlpp11/column.h @@ -36,7 +36,7 @@ #include #include #include -#include +#include namespace sqlpp { diff --git a/include/sqlpp11/detail/set.h b/include/sqlpp11/detail/set.h index 5ad62062..2b1a153f 100644 --- a/include/sqlpp11/detail/set.h +++ b/include/sqlpp11/detail/set.h @@ -28,7 +28,7 @@ #define SQLPP_DETAIL_SET_H #include -#include +#include namespace sqlpp { @@ -76,7 +76,7 @@ namespace sqlpp template struct is_superset_of { - static_assert(wrong::value, "invalid argument for is_superset_of"); + static_assert(::sqlpp::vendor::wrong_t::value, "invalid argument for is_superset_of"); }; template @@ -86,7 +86,7 @@ namespace sqlpp template struct join { - static_assert(wrong::value, "invalid argument for set::join"); + static_assert(::sqlpp::vendor::wrong_t::value, "invalid argument for set::join"); }; template @@ -96,7 +96,7 @@ namespace sqlpp template struct is_disjunct_from { - static_assert(wrong::value, "invalid argument for is_disjunct_from"); + static_assert(::sqlpp::vendor::wrong_t::value, "invalid argument for is_disjunct_from"); }; template @@ -106,7 +106,7 @@ namespace sqlpp template struct is_subset_of { - static_assert(wrong::value, "invalid argument for is_subset_of"); + static_assert(::sqlpp::vendor::wrong_t::value, "invalid argument for is_subset_of"); }; template @@ -116,7 +116,7 @@ namespace sqlpp template struct equals { - static_assert(wrong::value, "invalid argument for equals"); + static_assert(::sqlpp::vendor::wrong_t::value, "invalid argument for equals"); }; template diff --git a/include/sqlpp11/multi_column.h b/include/sqlpp11/multi_column.h index a1b69a44..f1099a0b 100644 --- a/include/sqlpp11/multi_column.h +++ b/include/sqlpp11/multi_column.h @@ -35,7 +35,7 @@ namespace sqlpp template struct multi_column_t { - static_assert(detail::wrong::value, "invalid argument for multicolumn_t"); + static_assert(vendor::wrong_t::value, "invalid argument for multicolumn_t"); }; template diff --git a/include/sqlpp11/parameter_list.h b/include/sqlpp11/parameter_list.h index 47fb3ac2..d1be7bd5 100644 --- a/include/sqlpp11/parameter_list.h +++ b/include/sqlpp11/parameter_list.h @@ -27,7 +27,7 @@ #ifndef SQLPP_PARAMETER_LIST_H #define SQLPP_PARAMETER_LIST_H -#include +#include #include namespace sqlpp @@ -35,7 +35,7 @@ namespace sqlpp template struct parameter_list_t { - static_assert(detail::wrong::value, "Template parameter for parameter_list_t has to be a tuple"); + static_assert(vendor::wrong_t::value, "Template parameter for parameter_list_t has to be a tuple"); }; template diff --git a/include/sqlpp11/select.h b/include/sqlpp11/select.h index 49c3de37..3ac3f687 100644 --- a/include/sqlpp11/select.h +++ b/include/sqlpp11/select.h @@ -45,7 +45,7 @@ #include #include -#include +#include #include #include diff --git a/include/sqlpp11/tvin.h b/include/sqlpp11/tvin.h index 363192c0..a3462d08 100644 --- a/include/sqlpp11/tvin.h +++ b/include/sqlpp11/tvin.h @@ -66,7 +66,7 @@ namespace sqlpp static void _(const T& t, Context& context) { - static_assert(detail::wrong::value, "tvin() must not be used with anything but =, ==, != and !"); + static_assert(vendor::wrong_t::value, "tvin() must not be used with anything but =, ==, != and !"); } }; } diff --git a/include/sqlpp11/vendor/expression.h b/include/sqlpp11/vendor/expression.h index b64ce3a6..df1c3f56 100644 --- a/include/sqlpp11/vendor/expression.h +++ b/include/sqlpp11/vendor/expression.h @@ -40,9 +40,9 @@ namespace sqlpp namespace vendor { template - struct equal_t: public detail::boolean::template operators> + struct equal_t: public ::sqlpp::detail::boolean::template operators> { - using _value_type = detail::boolean; + using _value_type = ::sqlpp::detail::boolean; using _parameter_tuple_t = std::tuple; equal_t(Lhs lhs, Rhs rhs): @@ -84,9 +84,9 @@ namespace sqlpp }; template - struct not_equal_t: public detail::boolean::template operators> + struct not_equal_t: public ::sqlpp::detail::boolean::template operators> { - using _value_type = detail::boolean; + using _value_type = ::sqlpp::detail::boolean; using _parameter_tuple_t = std::tuple; not_equal_t(Lhs lhs, Rhs rhs): @@ -128,9 +128,9 @@ namespace sqlpp }; template - struct logical_not_t: public detail::boolean::template operators> + struct logical_not_t: public ::sqlpp::detail::boolean::template operators> { - using _value_type = detail::boolean; + using _value_type = ::sqlpp::detail::boolean; using _parameter_tuple_t = std::tuple; logical_not_t(Lhs l): diff --git a/include/sqlpp11/vendor/expression_fwd.h b/include/sqlpp11/vendor/expression_fwd.h index 233a56fc..0cf2cfab 100644 --- a/include/sqlpp11/vendor/expression_fwd.h +++ b/include/sqlpp11/vendor/expression_fwd.h @@ -44,37 +44,37 @@ namespace sqlpp { struct less_than { - using _value_type = detail::boolean; + using _value_type = ::sqlpp::detail::boolean; static constexpr const char* _name = "<"; }; struct less_equal { - using _value_type = detail::boolean; + using _value_type = ::sqlpp::detail::boolean; static constexpr const char* _name = "<="; }; struct greater_equal { - using _value_type = detail::boolean; + using _value_type = ::sqlpp::detail::boolean; static constexpr const char* _name = ">="; }; struct greater_than { - using _value_type = detail::boolean; + using _value_type = ::sqlpp::detail::boolean; static constexpr const char* _name = ">"; }; struct logical_or { - using _value_type = detail::boolean; + using _value_type = ::sqlpp::detail::boolean; static constexpr const char* _name = " OR "; }; struct logical_and { - using _value_type = detail::boolean; + using _value_type = ::sqlpp::detail::boolean; static constexpr const char* _name = " AND "; }; @@ -101,13 +101,13 @@ namespace sqlpp struct divides { - using _value_type = detail::floating_point; + using _value_type = ::sqlpp::detail::floating_point; static constexpr const char* _name = "/"; }; struct modulus { - using _value_type = detail::integral; + using _value_type = ::sqlpp::detail::integral; static constexpr const char* _name = "%"; }; diff --git a/include/sqlpp11/vendor/interpreter.h b/include/sqlpp11/vendor/interpreter.h index 37df5cd7..547d7ebd 100644 --- a/include/sqlpp11/vendor/interpreter.h +++ b/include/sqlpp11/vendor/interpreter.h @@ -27,7 +27,7 @@ #ifndef SQLPP_VENDOR_INTERPRET_H #define SQLPP_VENDOR_INTERPRET_H -#include +#include namespace sqlpp { @@ -38,7 +38,7 @@ namespace sqlpp { static void _(const T& t, Context& context) { - static_assert(detail::wrong::value, "missing interpreter specialization"); + static_assert(wrong_t::value, "missing interpreter specialization"); } }; } diff --git a/include/sqlpp11/vendor/select_column_list.h b/include/sqlpp11/vendor/select_column_list.h index a48db6f8..a0671742 100644 --- a/include/sqlpp11/vendor/select_column_list.h +++ b/include/sqlpp11/vendor/select_column_list.h @@ -133,7 +133,7 @@ namespace sqlpp template struct select_column_list_t { - static_assert(::sqlpp::detail::wrong::value, "invalid template argument for select_column_list"); + static_assert(::sqlpp::vendor::wrong_t::value, "invalid template argument for select_column_list"); }; template diff --git a/include/sqlpp11/vendor/select_flag_list.h b/include/sqlpp11/vendor/select_flag_list.h index ab5e4918..20a537b7 100644 --- a/include/sqlpp11/vendor/select_flag_list.h +++ b/include/sqlpp11/vendor/select_flag_list.h @@ -41,7 +41,7 @@ namespace sqlpp template struct select_flag_list_t { - static_assert(::sqlpp::detail::wrong::value, "invalid argument for select_flag_list"); + static_assert(::sqlpp::vendor::wrong_t::value, "invalid argument for select_flag_list"); }; // select_flag_list_t diff --git a/include/sqlpp11/vendor/wrap_operand.h b/include/sqlpp11/vendor/wrap_operand.h index b3873009..3b221e1f 100644 --- a/include/sqlpp11/vendor/wrap_operand.h +++ b/include/sqlpp11/vendor/wrap_operand.h @@ -45,7 +45,7 @@ namespace sqlpp struct boolean_operand { static constexpr bool _is_expression = true; - using _value_type = detail::boolean; + using _value_type = sqlpp::detail::boolean; bool _is_trivial() const { return _t == false; } @@ -68,7 +68,7 @@ namespace sqlpp struct integral_operand { static constexpr bool _is_expression = true; - using _value_type = detail::integral; + using _value_type = ::sqlpp::detail::integral; bool _is_trivial() const { return _t == 0; } @@ -92,7 +92,7 @@ namespace sqlpp struct floating_point_operand { static constexpr bool _is_expression = true; - using _value_type = detail::floating_point; + using _value_type = ::sqlpp::detail::floating_point; bool _is_trivial() const { return _t == 0; } @@ -114,7 +114,7 @@ namespace sqlpp struct text_operand { static constexpr bool _is_expression = true; - using _value_type = detail::text; + using _value_type = ::sqlpp::detail::text; bool _is_trivial() const { return _t.empty(); } diff --git a/include/sqlpp11/detail/wrong.h b/include/sqlpp11/vendor/wrong.h similarity index 76% rename from include/sqlpp11/detail/wrong.h rename to include/sqlpp11/vendor/wrong.h index 110ba2c9..a37462ba 100644 --- a/include/sqlpp11/detail/wrong.h +++ b/include/sqlpp11/vendor/wrong.h @@ -24,19 +24,29 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SQLPP_DETAIL_WRONG_H -#define SQLPP_DETAIL_WRONG_H +#ifndef SQLPP_VENDOR_WRONG_H +#define SQLPP_VENDOR_WRONG_H #include namespace sqlpp { - namespace detail + namespace vendor { - // A template that always returns false - // To be used with static assert, for instance, to ensure it - // fires only when the template is instantiated. - template struct wrong : std::false_type {}; + namespace detail + { + // A template that always returns false + // To be used with static assert, for instance, to ensure it + // fires only when the template is instantiated. + template struct wrong_t + { + using type = std::false_type; + }; + } + + template + using wrong_t = typename detail::wrong_t::type; } + } #endif