Personnellement je pense que c'est un énorme boulot si on veut que ça ait un quelconque intérêt, et que même un compilateur C++ entier n'apporterait, finalement, pas grand chose...
cela dit, quand on regarde "C++ Templates and Turing Completeness" dans le post de nitro c'est assez impressionnantça a l'air assez sympa les templates...
En tout cas Visual C++ 6.0 ne compile pas du tout l'exemple qu'ils donnent - 73 erreursje me demande quels compilo acceptent ça)
Ce n'est qu'un package parmi tous ceux qu'il faut DL.
#define CheckItems(Type,Item) \ ({ \ const Type *Item = Find##Item##AtPos (Section, Start, FALSE) ? : GetFirst (Section->Item##s); \ while (Item && (Item->Location < End)) \ { \ if ((Item != Exception) && (RangesOverlap (Start, End, Item->Location, Item->Location + Item->Size))) \ return FALSE; \ Item = GetNext (Item); \ } \ }) CheckItems (RELOC, Reloc); CheckItems (ROM_CALL, ROMCall); CheckItems (RAM_CALL, RAMCall); CheckItems (LIB_CALL, LibCall); #undef CheckItems
// Find the item preceding or following the given location. May return NULL. #define DefineFindItemAtPos(Type,Item,LocationSuffix) \ Type *Find##Item##AtPos (const SECTION *Section, OFFSET Location, BOOLEAN Following) \ { \ /* Find the place so that Item->Location is always less than Location */ \ /* and Next##Item->Location is always greater or equal. */ \ Type *Item = NULL, *Next##Item = NULL; \ if (Location > Section->Size / 2) \ { \ Item = GetLast (Section->Item##s); \ while (Item && (Item->Location LocationSuffix >= Location)) \ { \ Next##Item = Item; \ Item = GetPrev (Item); \ } \ } \ else \ { \ Next##Item = GetFirst (Section->Item##s); \ while (Next##Item && (Next##Item->Location LocationSuffix < Location)) \ { \ Item = Next##Item; \ Next##Item = GetNext (Next##Item); \ } \ } \ /* If we are looking for something that follows, the case is clear. */ \ /* Otherwise, we need to check whether the next item is also OK. */ \ if (Following || (Next##Item && (Next##Item->Location LocationSuffix <= Location))) \ return Next##Item; \ else \ return Item; \ } DefineFindItemAtPos (SYMBOL, Symbol, ); DefineFindItemAtPos (RELOC, Reloc, ); DefineFindItemAtPos (ROM_CALL, ROMCall, ); DefineFindItemAtPos (RAM_CALL, RAMCall, ); DefineFindItemAtPos (LIB_CALL, LibCall, ); DefineFindItemAtPos (SEGMENT, Segment, .Start->Location); #undef DefineFindItemAtPos
example.cc:21: conversion from `double' to non-scalar type `map<vector<basic_string<char,string_char_traits<char>, __default_alloc_template<true,0> >,allocator<basic_string<char,string_char_traits<char>,__default_alloc_template<t rue,0> > > >,set<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >,less<basic_string<c har,string_char_traits<char>,__default_alloc_template<true,0> > >,allocator<basic_string<char,string_char_traits<c har>,__default_alloc_template<true,0> > > >,less<vector<basic_string<char,string_char_traits<char>,__default_alloc _template<true,0> >,allocator<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> > > > >, allocator<set<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >,less<basic_string<char ,string_char_traits<char>,__default_alloc_template<true,0> > >,allocator<basic_string<char,string_char_traits<char >,__default_alloc_template<true,0> > > > > >' requested
example.cc:21: conversion from `double' to non-scalar type `map<...>' requested
nitro
: Bah oui c'est parfaitement clair. Le nom du type paramétré est très long mais ça permet de savoir exactement ce qui est instancié.
Le message est tout simplement :example.cc:21: conversion from `double' to non-scalar type `map<...>' requestedFranchement je ne trouve pas ça compliqué.
Et tu n'a pas répondu à mon dernier message il me semble ?