concept_check.h revision 169691
155714Skris// Concept-checking control -*- C++ -*- 255714Skris 355714Skris// Copyright (C) 2001 Free Software Foundation, Inc. 455714Skris// 555714Skris// This file is part of the GNU ISO C++ Library. This library is free 655714Skris// software; you can redistribute it and/or modify it under the 755714Skris// terms of the GNU General Public License as published by the 855714Skris// Free Software Foundation; either version 2, or (at your option) 955714Skris// any later version. 1055714Skris 1155714Skris// This library is distributed in the hope that it will be useful, 1255714Skris// but WITHOUT ANY WARRANTY; without even the implied warranty of 1355714Skris// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1455714Skris// GNU General Public License for more details. 1555714Skris 1655714Skris// You should have received a copy of the GNU General Public License along 1755714Skris// with this library; see the file COPYING. If not, write to the Free 1855714Skris// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 1955714Skris// USA. 2055714Skris 2155714Skris// As a special exception, you may use this file as part of a free software 2255714Skris// library without restriction. Specifically, if other files instantiate 2355714Skris// templates or use macros or inline functions from this file, or you compile 2455714Skris// this file and link it with other files to produce an executable, this 2555714Skris// file does not by itself cause the resulting executable to be covered by 2655714Skris// the GNU General Public License. This exception does not however 2755714Skris// invalidate any other reasons why the executable file might be covered by 2855714Skris// the GNU General Public License. 2955714Skris 3055714Skris/** @file concept_check.h 3155714Skris * This is an internal header file, included by other library headers. 3255714Skris * You should not attempt to use it directly. 3355714Skris */ 3455714Skris 3555714Skris#ifndef _CONCEPT_CHECK_H 3655714Skris#define _CONCEPT_CHECK_H 1 3755714Skris 3855714Skris#pragma GCC system_header 3955714Skris 4055714Skris#include <bits/c++config.h> 4155714Skris 4255714Skris// All places in libstdc++-v3 where these are used, or /might/ be used, or 4355714Skris// don't need to be used, or perhaps /should/ be used, are commented with 4455714Skris// "concept requirements" (and maybe some more text). So grep like crazy 4555714Skris// if you're looking for additional places to use these. 4655714Skris 4755714Skris// Concept-checking code is off by default unless users turn it on via 4855714Skris// configure options or editing c++config.h. 4955714Skris 5055714Skris#ifndef _GLIBCXX_CONCEPT_CHECKS 5155714Skris 5255714Skris#define __glibcxx_function_requires(...) 5355714Skris#define __glibcxx_class_requires(_a,_b) 5455714Skris#define __glibcxx_class_requires2(_a,_b,_c) 5555714Skris#define __glibcxx_class_requires3(_a,_b,_c,_d) 5655714Skris#define __glibcxx_class_requires4(_a,_b,_c,_d,_e) 5755714Skris 5855714Skris#else // the checks are on 5955714Skris 6055714Skris#include <bits/boost_concept_check.h> 6155714Skris 6255714Skris// Note that the obvious and elegant approach of 6355714Skris// 6455714Skris//#define glibcxx_function_requires(C) boost::function_requires< boost::C >() 6555714Skris// 6655714Skris// won't work due to concept templates with more than one parameter, e.g., 6755714Skris// BinaryPredicateConcept. The preprocessor tries to split things up on 6855714Skris// the commas in the template argument list. We can't use an inner pair of 6955714Skris// parenthesis to hide the commas, because "boost::(Temp<Foo,Bar>)" isn't 7055714Skris// a valid instantiation pattern. Thus, we steal a feature from C99. 7155714Skris 7255714Skris#define __glibcxx_function_requires(...) \ 7355714Skris __gnu_cxx::__function_requires< __gnu_cxx::__VA_ARGS__ >(); 7455714Skris#define __glibcxx_class_requires(_a,_C) \ 7555714Skris _GLIBCXX_CLASS_REQUIRES(_a, __gnu_cxx, _C); 7655714Skris#define __glibcxx_class_requires2(_a,_b,_C) \ 7755714Skris _GLIBCXX_CLASS_REQUIRES2(_a, _b, __gnu_cxx, _C); 7855714Skris#define __glibcxx_class_requires3(_a,_b,_c,_C) \ 7955714Skris _GLIBCXX_CLASS_REQUIRES3(_a, _b, _c, __gnu_cxx, _C); 8055714Skris#define __glibcxx_class_requires4(_a,_b,_c,_d,_C) \ 8155714Skris _GLIBCXX_CLASS_REQUIRES4(_a, _b, _c, _d, __gnu_cxx, _C); 8255714Skris 8355714Skris#endif // enable/disable 8455714Skris 8555714Skris#endif // _GLIBCXX_CONCEPT_CHECK 8655714Skris