197403Sobrien// Concept-checking control -*- C++ -*- 297403Sobrien 397403Sobrien// Copyright (C) 2001 Free Software Foundation, Inc. 497403Sobrien// 597403Sobrien// This file is part of the GNU ISO C++ Library. This library is free 697403Sobrien// software; you can redistribute it and/or modify it under the 797403Sobrien// terms of the GNU General Public License as published by the 897403Sobrien// Free Software Foundation; either version 2, or (at your option) 997403Sobrien// any later version. 1097403Sobrien 1197403Sobrien// This library is distributed in the hope that it will be useful, 1297403Sobrien// but WITHOUT ANY WARRANTY; without even the implied warranty of 1397403Sobrien// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1497403Sobrien// GNU General Public License for more details. 1597403Sobrien 1697403Sobrien// You should have received a copy of the GNU General Public License along 1797403Sobrien// with this library; see the file COPYING. If not, write to the Free 18169691Skan// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 1997403Sobrien// USA. 2097403Sobrien 2197403Sobrien// As a special exception, you may use this file as part of a free software 2297403Sobrien// library without restriction. Specifically, if other files instantiate 2397403Sobrien// templates or use macros or inline functions from this file, or you compile 2497403Sobrien// this file and link it with other files to produce an executable, this 2597403Sobrien// file does not by itself cause the resulting executable to be covered by 2697403Sobrien// the GNU General Public License. This exception does not however 2797403Sobrien// invalidate any other reasons why the executable file might be covered by 2897403Sobrien// the GNU General Public License. 2997403Sobrien 3097403Sobrien/** @file concept_check.h 3197403Sobrien * This is an internal header file, included by other library headers. 3297403Sobrien * You should not attempt to use it directly. 3397403Sobrien */ 3497403Sobrien 35132720Skan#ifndef _CONCEPT_CHECK_H 36132720Skan#define _CONCEPT_CHECK_H 1 3797403Sobrien 3897403Sobrien#pragma GCC system_header 3997403Sobrien 4097403Sobrien#include <bits/c++config.h> 4197403Sobrien 4297403Sobrien// All places in libstdc++-v3 where these are used, or /might/ be used, or 4397403Sobrien// don't need to be used, or perhaps /should/ be used, are commented with 4497403Sobrien// "concept requirements" (and maybe some more text). So grep like crazy 4597403Sobrien// if you're looking for additional places to use these. 4697403Sobrien 4797403Sobrien// Concept-checking code is off by default unless users turn it on via 4897403Sobrien// configure options or editing c++config.h. 4997403Sobrien 50132720Skan#ifndef _GLIBCXX_CONCEPT_CHECKS 5197403Sobrien 52132720Skan#define __glibcxx_function_requires(...) 53132720Skan#define __glibcxx_class_requires(_a,_b) 54132720Skan#define __glibcxx_class_requires2(_a,_b,_c) 55132720Skan#define __glibcxx_class_requires3(_a,_b,_c,_d) 56132720Skan#define __glibcxx_class_requires4(_a,_b,_c,_d,_e) 5797403Sobrien 5897403Sobrien#else // the checks are on 5997403Sobrien 6097403Sobrien#include <bits/boost_concept_check.h> 6197403Sobrien 6297403Sobrien// Note that the obvious and elegant approach of 6397403Sobrien// 64132720Skan//#define glibcxx_function_requires(C) boost::function_requires< boost::C >() 6597403Sobrien// 6697403Sobrien// won't work due to concept templates with more than one parameter, e.g., 6797403Sobrien// BinaryPredicateConcept. The preprocessor tries to split things up on 6897403Sobrien// the commas in the template argument list. We can't use an inner pair of 6997403Sobrien// parenthesis to hide the commas, because "boost::(Temp<Foo,Bar>)" isn't 7097403Sobrien// a valid instantiation pattern. Thus, we steal a feature from C99. 7197403Sobrien 72132720Skan#define __glibcxx_function_requires(...) \ 7397403Sobrien __gnu_cxx::__function_requires< __gnu_cxx::__VA_ARGS__ >(); 74132720Skan#define __glibcxx_class_requires(_a,_C) \ 75132720Skan _GLIBCXX_CLASS_REQUIRES(_a, __gnu_cxx, _C); 76132720Skan#define __glibcxx_class_requires2(_a,_b,_C) \ 77132720Skan _GLIBCXX_CLASS_REQUIRES2(_a, _b, __gnu_cxx, _C); 78132720Skan#define __glibcxx_class_requires3(_a,_b,_c,_C) \ 79132720Skan _GLIBCXX_CLASS_REQUIRES3(_a, _b, _c, __gnu_cxx, _C); 80132720Skan#define __glibcxx_class_requires4(_a,_b,_c,_d,_C) \ 81132720Skan _GLIBCXX_CLASS_REQUIRES4(_a, _b, _c, _d, __gnu_cxx, _C); 8297403Sobrien 8397403Sobrien#endif // enable/disable 8497403Sobrien 85132720Skan#endif // _GLIBCXX_CONCEPT_CHECK 86