concept_check.h revision 97403
1193326Sed// Concept-checking control -*- C++ -*- 2193326Sed 3193326Sed// Copyright (C) 2001 Free Software Foundation, Inc. 4193326Sed// 5193326Sed// This file is part of the GNU ISO C++ Library. This library is free 6193326Sed// software; you can redistribute it and/or modify it under the 7193326Sed// terms of the GNU General Public License as published by the 8193326Sed// Free Software Foundation; either version 2, or (at your option) 9193326Sed// any later version. 10199512Srdivacky 11199512Srdivacky// This library is distributed in the hope that it will be useful, 12193326Sed// but WITHOUT ANY WARRANTY; without even the implied warranty of 13263509Sdim// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14263509Sdim// GNU General Public License for more details. 15263509Sdim 16263509Sdim// You should have received a copy of the GNU General Public License along 17263509Sdim// with this library; see the file COPYING. If not, write to the Free 18263509Sdim// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 19193326Sed// USA. 20193326Sed 21199512Srdivacky// As a special exception, you may use this file as part of a free software 22193326Sed// library without restriction. Specifically, if other files instantiate 23263509Sdim// templates or use macros or inline functions from this file, or you compile 24263509Sdim// this file and link it with other files to produce an executable, this 25263509Sdim// file does not by itself cause the resulting executable to be covered by 26263509Sdim// the GNU General Public License. This exception does not however 27263509Sdim// invalidate any other reasons why the executable file might be covered by 28263509Sdim// the GNU General Public License. 29263509Sdim 30263509Sdim/** @file concept_check.h 31263509Sdim * This is an internal header file, included by other library headers. 32263509Sdim * You should not attempt to use it directly. 33263509Sdim */ 34263509Sdim 35263509Sdim#ifndef _GLIBCPP_CONCEPT_CHECK 36263509Sdim#define _GLIBCPP_CONCEPT_CHECK 1 37193326Sed 38263509Sdim#pragma GCC system_header 39193326Sed 40199512Srdivacky#include <bits/c++config.h> 41193326Sed 42193326Sed// All places in libstdc++-v3 where these are used, or /might/ be used, or 43193326Sed// don't need to be used, or perhaps /should/ be used, are commented with 44193326Sed// "concept requirements" (and maybe some more text). So grep like crazy 45198092Srdivacky// if you're looking for additional places to use these. 46263509Sdim 47193326Sed// Concept-checking code is off by default unless users turn it on via 48193326Sed// configure options or editing c++config.h. 49193326Sed 50193326Sed#ifndef _GLIBCPP_CONCEPT_CHECKS 51 52#define __glibcpp_function_requires(...) 53#define __glibcpp_class_requires(_a,_b) 54#define __glibcpp_class_requires2(_a,_b,_c) 55#define __glibcpp_class_requires3(_a,_b,_c,_d) 56#define __glibcpp_class_requires4(_a,_b,_c,_d,_e) 57 58#else // the checks are on 59 60#include <bits/boost_concept_check.h> 61 62// Note that the obvious and elegant approach of 63// 64//#define glibcpp_function_requires(C) \ 65// boost::function_requires< boost::C >() 66// 67// won't work due to concept templates with more than one parameter, e.g., 68// BinaryPredicateConcept. The preprocessor tries to split things up on 69// the commas in the template argument list. We can't use an inner pair of 70// parenthesis to hide the commas, because "boost::(Temp<Foo,Bar>)" isn't 71// a valid instantiation pattern. Thus, we steal a feature from C99. 72 73#define __glibcpp_function_requires(...) \ 74 __gnu_cxx::__function_requires< __gnu_cxx::__VA_ARGS__ >(); 75#define __glibcpp_class_requires(_a,_C) \ 76 _GLIBCPP_CLASS_REQUIRES(_a, __gnu_cxx, _C); 77#define __glibcpp_class_requires2(_a,_b,_C) \ 78 _GLIBCPP_CLASS_REQUIRES2(_a, _b, __gnu_cxx, _C); 79#define __glibcpp_class_requires3(_a,_b,_c,_C) \ 80 _GLIBCPP_CLASS_REQUIRES3(_a, _b, _c, __gnu_cxx, _C); 81#define __glibcpp_class_requires4(_a,_b,_c,_d,_C) \ 82 _GLIBCPP_CLASS_REQUIRES4(_a, _b, _c, _d, __gnu_cxx, _C); 83 84#endif // enable/disable 85 86#endif // _GLIBCPP_CONCEPT_CHECK 87