Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 1 | // Copyright David Abrahams 2006. Distributed under the Boost |
| 2 | // Software License, Version 1.0. (See accompanying |
| 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 4 | #ifndef NDNBOOST_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP |
| 5 | # define NDNBOOST_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 6 | # include <ndnboost/preprocessor/seq/for_each_i.hpp> |
| 7 | # include <ndnboost/preprocessor/seq/enum.hpp> |
| 8 | # include <ndnboost/preprocessor/comma_if.hpp> |
| 9 | # include <ndnboost/preprocessor/cat.hpp> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 10 | #endif // NDNBOOST_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 11 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 12 | // NDNBOOST_concept(SomeName, (p1)(p2)...(pN)) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 13 | // |
| 14 | // Expands to "template <class p1, class p2, ...class pN> struct SomeName" |
| 15 | // |
| 16 | // Also defines an equivalent SomeNameConcept for backward compatibility. |
| 17 | // Maybe in the next release we can kill off the "Concept" suffix for good. |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 18 | #if NDNBOOST_WORKAROUND(__GNUC__, <= 3) |
| 19 | # define NDNBOOST_concept(name, params) \ |
| 20 | template < NDNBOOST_PP_SEQ_FOR_EACH_I(NDNBOOST_CONCEPT_typename,~,params) > \ |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 21 | struct name; /* forward declaration */ \ |
| 22 | \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 23 | template < NDNBOOST_PP_SEQ_FOR_EACH_I(NDNBOOST_CONCEPT_typename,~,params) > \ |
| 24 | struct NDNBOOST_PP_CAT(name,Concept) \ |
| 25 | : name< NDNBOOST_PP_SEQ_ENUM(params) > \ |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 26 | { \ |
| 27 | /* at least 2.96 and 3.4.3 both need this */ \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 28 | NDNBOOST_PP_CAT(name,Concept)(); \ |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 29 | }; \ |
| 30 | \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 31 | template < NDNBOOST_PP_SEQ_FOR_EACH_I(NDNBOOST_CONCEPT_typename,~,params) > \ |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 32 | struct name |
| 33 | #else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 34 | # define NDNBOOST_concept(name, params) \ |
| 35 | template < NDNBOOST_PP_SEQ_FOR_EACH_I(NDNBOOST_CONCEPT_typename,~,params) > \ |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 36 | struct name; /* forward declaration */ \ |
| 37 | \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 38 | template < NDNBOOST_PP_SEQ_FOR_EACH_I(NDNBOOST_CONCEPT_typename,~,params) > \ |
| 39 | struct NDNBOOST_PP_CAT(name,Concept) \ |
| 40 | : name< NDNBOOST_PP_SEQ_ENUM(params) > \ |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 41 | { \ |
| 42 | }; \ |
| 43 | \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 44 | template < NDNBOOST_PP_SEQ_FOR_EACH_I(NDNBOOST_CONCEPT_typename,~,params) > \ |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 45 | struct name |
| 46 | #endif |
| 47 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 48 | // Helper for NDNBOOST_concept, above. |
| 49 | # define NDNBOOST_CONCEPT_typename(r, ignored, index, t) \ |
| 50 | NDNBOOST_PP_COMMA_IF(index) typename t |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 51 | |