From 8717359939520136137 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,dfc54ea33076c0fe,start X-Google-Attributes: gidf78e5,public From: Joel Conraud Subject: type requirements for template instantiation Date: 1997/10/03 Message-ID: #1/1 X-Deja-AN: 277538855 X-Original-Date: 03 Oct 1997 11:15:40 +0200 Organization: CIRIL, Nancy, France X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANDS7ZuEDnX0m9pzZAQHJ8AF/YC0E2GRMgI89M46fwqgbtUmX7d0aCxTC XUVGwrFB9Ibsgh/STe5LVVIS3q63bwua =HCUf Newsgroups: comp.std.c++ Hello, With the growing use of template mechanism, wouldn't be interesting to be able to write code like this : template class Triangulation { public: ... private: ... requires: <- // NEW KEYWORD HERE float XYPoint::x() const; float XYPoint::y() const; }; My - humble - proposal is to add, with a syntax or another, a clause to enumerate what we want a type to provide in order to be used in a given template. By expliciting the requirements on the type we want to use, we get several advantages : - as this kind of information is mandatory, up to know, it is provided (when it is provided :-)) in comments, or software document ; so there is no language constraints for giving this information. - if this piece of information is available, I guess it could help compiler vendors to manage template mechanism more easily, for example by testing statically a templated type declaration and checks if a type fits or not the requirements. Any comments ? ----- Joel CONRAUD TSurf SA - gOcad maintenance team Tel : +33 3.83.50.30.25 / Fax : +33 3.83.51.23.12 --- [ comp.std.c++ is moderated. To submit articles: try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ] [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ] [ Comments? mailto:std-c++-request@ncar.ucar.edu ]