Olena-patches
  Threads by month 
                
            - ----- 2025 -----
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2024 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2023 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2022 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2021 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2020 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2019 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2018 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2017 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2016 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2015 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2014 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2013 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2012 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2011 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2010 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2009 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2008 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2007 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2006 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2005 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - February
 - January
 - ----- 2004 -----
 - December
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 
- 9625 discussions
 
                    
                        
https://svn/svn/oln/prototypes/proto-1.0
Index: ChangeLog
from  Nicolas Widynski  <nicolas.widynski(a)lrde.epita.fr>
	Add GPL License to trunk.
	* COPYING: New. GNU Free Documentation License.
 COPYING |  397 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 397 insertions(+)
Index: COPYING
--- COPYING	(revision 0)
+++ COPYING	(revision 0)
@@ -0,0 +1,397 @@
+GNU Free Documentation License
+		  Version 1.2, November 2002
+
+
+ Copyright (C) 2000,2001,2002,2006 Free Software Foundation, Inc.
+     51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+0. PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+functional and useful document "free" in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+
+This License is a kind of "copyleft", which means that derivative
+works of the document must themselves be free in the same sense.  It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does.  But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book.  We recommend this License
+principally for works whose purpose is instruction or reference.
+
+
+1. APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License.  Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein.  The "Document", below,
+refers to any such manual or work.  Any member of the public is a
+licensee, and is addressed as "you".  You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+
+A "Modified Version" of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A "Secondary Section" is a named appendix or a front-matter section of
+the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall subject
+(or to related matters) and contains nothing that could fall directly
+within that overall subject.  (Thus, if the Document is in part a
+textbook of mathematics, a Secondary Section may not explain any
+mathematics.)  The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The "Invariant Sections" are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License.  If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant.  The Document may contain zero
+Invariant Sections.  If the Document does not identify any Invariant
+Sections then there are none.
+
+The "Cover Texts" are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License.  A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+A "Transparent" copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters.  A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arranged to thwart
+or discourage subsequent modification by readers is not Transparent.
+An image format is not Transparent if used for any substantial amount
+of text.  A copy that is not "Transparent" is called "Opaque".
+
+Examples of suitable formats for Transparent copies include plain
+ASCII without markup, Texinfo input format, LaTeX input format, SGML
+or XML using a publicly available DTD, and standard-conforming simple
+HTML, PostScript or PDF designed for human modification.  Examples of
+transparent image formats include PNG, XCF and JPG.  Opaque formats
+include proprietary formats that can be read and edited only by
+proprietary word processors, SGML or XML for which the DTD and/or
+processing tools are not generally available, and the
+machine-generated HTML, PostScript or PDF produced by some word
+processors for output purposes only.
+
+The "Title Page" means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page.  For works in
+formats which do not have any title page as such, "Title Page" means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+
+A section "Entitled XYZ" means a named subunit of the Document whose
+title either is precisely XYZ or contains XYZ in parentheses following
+text that translates XYZ in another language.  (Here XYZ stands for a
+specific section name mentioned below, such as "Acknowledgements",
+"Dedications", "Endorsements", or "History".)  To "Preserve the Title"
+of such a section when you modify the Document means that it remains a
+section "Entitled XYZ" according to this definition.
+
+The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document.  These Warranty
+Disclaimers are considered to be included by reference in this
+License, but only as regards disclaiming warranties: any other
+implication that these Warranty Disclaimers may have is void and has
+no effect on the meaning of this License.
+
+
+2. VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License.  You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute.  However, you may accept
+compensation in exchange for copies.  If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+
+
+3. COPYING IN QUANTITY
+
+If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document's license notice requires Cover Texts, you must enclose the
+copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover.  Both covers must also clearly and legibly identify
+you as the publisher of these copies.  The front cover must present
+the full title with all words of the title equally prominent and
+visible.  You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a computer-network location from which the general network-using
+public has access to download using public-standard network protocols
+a complete Transparent copy of the Document, free of added material.
+If you use the latter option, you must take reasonably prudent steps,
+when you begin distribution of Opaque copies in quantity, to ensure
+that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an
+Opaque copy (directly or through your agents or retailers) of that
+edition to the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+
+
+4. MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it.  In addition, you must do these things in the Modified Version:
+
+A. Use in the Title Page (and on the covers, if any) a title distinct
+   from that of the Document, and from those of previous versions
+   (which should, if there were any, be listed in the History section
+   of the Document).  You may use the same title as a previous version
+   if the original publisher of that version gives permission.
+B. List on the Title Page, as authors, one or more persons or entities
+   responsible for authorship of the modifications in the Modified
+   Version, together with at least five of the principal authors of the
+   Document (all of its principal authors, if it has fewer than five),
+   unless they release you from this requirement.
+C. State on the Title page the name of the publisher of the
+   Modified Version, as the publisher.
+D. Preserve all the copyright notices of the Document.
+E. Add an appropriate copyright notice for your modifications
+   adjacent to the other copyright notices.
+F. Include, immediately after the copyright notices, a license notice
+   giving the public permission to use the Modified Version under the
+   terms of this License, in the form shown in the Addendum below.
+G. Preserve in that license notice the full lists of Invariant Sections
+   and required Cover Texts given in the Document's license notice.
+H. Include an unaltered copy of this License.
+I. Preserve the section Entitled "History", Preserve its Title, and add
+   to it an item stating at least the title, year, new authors, and
+   publisher of the Modified Version as given on the Title Page.  If
+   there is no section Entitled "History" in the Document, create one
+   stating the title, year, authors, and publisher of the Document as
+   given on its Title Page, then add an item describing the Modified
+   Version as stated in the previous sentence.
+J. Preserve the network location, if any, given in the Document for
+   public access to a Transparent copy of the Document, and likewise
+   the network locations given in the Document for previous versions
+   it was based on.  These may be placed in the "History" section.
+   You may omit a network location for a work that was published at
+   least four years before the Document itself, or if the original
+   publisher of the version it refers to gives permission.
+K. For any section Entitled "Acknowledgements" or "Dedications",
+   Preserve the Title of the section, and preserve in the section all
+   the substance and tone of each of the contributor acknowledgements
+   and/or dedications given therein.
+L. Preserve all the Invariant Sections of the Document,
+   unaltered in their text and in their titles.  Section numbers
+   or the equivalent are not considered part of the section titles.
+M. Delete any section Entitled "Endorsements".  Such a section
+   may not be included in the Modified Version.
+N. Do not retitle any existing section to be Entitled "Endorsements"
+   or to conflict in title with any Invariant Section.
+O. Preserve any Warranty Disclaimers.
+
+If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant.  To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+You may add a section Entitled "Endorsements", provided it contains
+nothing but endorsements of your Modified Version by various
+parties--for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version.  Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity.  If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+
+
+5. COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice, and that you preserve all their Warranty Disclaimers.
+
+The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy.  If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections Entitled "History"
+in the various original documents, forming one section Entitled
+"History"; likewise combine any sections Entitled "Acknowledgements",
+and any sections Entitled "Dedications".  You must delete all sections
+Entitled "Endorsements".
+
+
+6. COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+
+
+7. AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, is called an "aggregate" if the copyright
+resulting from the compilation is not used to limit the legal rights
+of the compilation's users beyond what the individual works permit.
+When the Document is included in an aggregate, this License does not
+apply to the other works in the aggregate which are not themselves
+derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one half of
+the entire aggregate, the Document's Cover Texts may be placed on
+covers that bracket the Document within the aggregate, or the
+electronic equivalent of covers if the Document is in electronic form.
+Otherwise they must appear on printed covers that bracket the whole
+aggregate.
+
+
+8. TRANSLATION
+
+Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections.  You may include a
+translation of this License, and all the license notices in the
+Document, and any Warranty Disclaimers, provided that you also include
+the original English version of this License and the original versions
+of those notices and disclaimers.  In case of a disagreement between
+the translation and the original version of this License or a notice
+or disclaimer, the original version will prevail.
+
+If a section in the Document is Entitled "Acknowledgements",
+"Dedications", or "History", the requirement (section 4) to Preserve
+its Title (section 1) will typically require changing the actual
+title.
+
+
+9. TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document except
+as expressly provided for under this License.  Any other attempt to
+copy, modify, sublicense or distribute the Document is void, and will
+automatically terminate your rights under this License.  However,
+parties who have received copies, or rights, from you under this
+License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+
+10. FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation License from time to time.  Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.  See
+http://www.gnu.org/copyleft/.
+
+Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License "or any later version" applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation.  If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation.
+
+
+ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
+    Copyright (c)  YEAR  YOUR NAME.
+    Permission is granted to copy, distribute and/or modify this document
+    under the terms of the GNU Free Documentation License, Version 1.2
+    or any later version published by the Free Software Foundation;
+    with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
+    A copy of the license is included in the section entitled "GNU
+    Free Documentation License".
+
+If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the "with...Texts." line with this:
+
+    with the Invariant Sections being LIST THEIR TITLES, with the
+    Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
+
+If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
\ No newline at end of file
                    
                  
                  
                          
                            
                            2
                            
                          
                          
                            
                            1
                            
                          
                          
                            
    
                          
                        
                    23 Mar '06
                    
                        https://svn.lrde.epita.fr/svn/oln/trunk/static
Index: ChangeLog
from  Roland Levillain  <roland(a)lrde.epita.fr>
	Extensible entry points in a class hierarchy (first version).
	* stc/entry.hh: New.
	* tests/entry.cc: New test.
	* stc/Makefile.am (nobase_stc_HEADERS): Add entry.hh.
	* tests/Makefile.am (check_PROGRAMS): Add `entry'.
	(entry_SOURCES): New.
 stc/Makefile.am   |    1 
 stc/entry.hh      |  151 ++++++++++++++++++++++++++++++
 tests/Makefile.am |    2 
 tests/entry.cc    |  267 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 421 insertions(+)
Index: tests/entry.cc
--- tests/entry.cc	(revision 0)
+++ tests/entry.cc	(revision 0)
@@ -0,0 +1,267 @@
+/// Test the extensible entry points in a class hierarchy.
+
+#include <stc/entry.hh>
+
+#include <mlc/case.hh>
+#include <mlc/assert.hh>
+#include <mlc/is_a.hh>
+
+// FIXME: Fake.  Remove this when mlc::abort_ is added to the project.
+namespace mlc
+{
+  template <typename T>
+  class abort_ {};
+}
+
+
+/*----------.
+| Library.  |
+`----------*/
+
+/* Simplified class diagram.
+
+
+				/top/
+				  ^
+				  |
+		     ,------------+------------.
+		     |                         |
+	       /property1/                 /property2/
+		     ^                         ^
+		     |                         |
+	       ,-----+-----.             ,-----+-----.
+	       |           |             |           |
+      /property1a/   /property1b/   /property2a/   /property2b/
+	       |           |             |           |
+	       o           o             o           o
+		     o                         o
+		     |                         |
+	 stc::set_entry_node<C,1>    stc::set_entry_node<C,1>
+	     (first selector)           (second selector)
+		     ^                         ^
+		     |                         |
+
+		     `------------+------------'
+				  |
+				entry
+				  ^
+				  |
+				 foo
+
+
+   In fact, this is closer to this :
+
+				/top/
+				  ^
+				  |
+				  |
+			     /property2/
+				  ^
+				  |
+			    ,-----+-----.
+			    |           |
+		     /property2a/   /property2b/
+			    |           |
+			    o           o
+				  o
+				  |
+		      stc::set_entry_node<foo,2>
+			  (second selector)
+				  ^
+				  |
+			     /property1/
+				  ^
+				  |
+			    ,-----+-----.
+			    |           |
+		     /property1a/   /property1b/
+			    |           |
+			    o           o
+				  o
+				  |
+		      stc::set_entry_node<foo,1>
+			   (first selector)
+				  ^
+				  |
+				entry
+				  ^
+				  |
+				 foo
+
+*/
+
+namespace my_lib
+{
+  // Virtual types.
+  // We don't use all the equipment of stc/properties.hh for
+  // simplicity purpose.
+  template <typename T>
+  struct vtypes
+  {
+    // Nothing.
+  };
+
+  /// Top of the hierachy.
+  struct top {};
+
+  /// Property 1.
+  /// \{
+  struct property1 : virtual public top {};
+  struct property1a : public property1 {};
+  struct property1b : public property1 {};
+  /// \}
+
+  /// Property 2.
+  /// \{
+  struct property2 : virtual public top {};
+  struct property2a : public property2 {};
+  struct property2b : public property2 {};
+  /// \}
+}
+
+mlc_case_equipment_for_namespace(my_lib);
+
+
+// -------------------------- //
+// Equipment for property 1.  //
+// -------------------------- //
+
+namespace my_lib
+{
+  // Switch on property 1.
+  /// \{
+  struct prop1_tag;
+
+  template <typename prop1_type>
+  struct case_<prop1_tag, prop1_type, 1> :
+    // Test.
+    public mlc::where_< mlc_is_a(prop1_type, int) >
+  {
+    // Super class if test succeed.
+    typedef property1a ret;
+  };
+
+  template <typename prop1_type>
+  struct case_<prop1_tag, prop1_type, 2> :
+    // Test.
+    public mlc::where_< mlc_is_a(prop1_type, long) >
+  {
+    // Super class if test succeed.
+    typedef property1b ret;
+  };
+
+  template <typename prop1_type>
+  struct default_case_<prop1_tag, prop1_type>
+  {
+    typedef mlc::abort_<prop1_tag> ret;
+  };
+  /// \}
+
+} // End of namespace my_lib
+
+// FIXME: Maybe set/get_entry_node should be moved inside a macro?
+namespace stc
+{
+  /// Property 1.
+  /// E is for Exact.
+  template <typename E>
+  struct set_entry_node<E, 1> :
+    public my_lib::switch_<my_lib::prop1_tag,
+			   typename my_lib::vtypes<E>::prop1>::ret
+  {
+  };
+}
+
+// -------------------------- //
+// Equipment for property 2.  //
+// -------------------------- //
+
+namespace my_lib
+{
+  // Switch on property 2.
+  /// \{
+  struct prop2_tag;
+
+  template <typename prop2_type>
+  struct case_<prop2_tag, prop2_type, 1> :
+    // Test.
+    public mlc::where_< mlc_is_a(prop2_type, float) >
+  {
+    // Super class if test succeed.
+    typedef property2a ret;
+  };
+
+  template <typename prop2_type>
+  struct case_<prop2_tag, prop2_type, 2> :
+    // Test.
+    public mlc::where_< mlc_is_a(prop2_type, double) >
+  {
+    // Super class if test succeed.
+    typedef property2b ret;
+  };
+
+  template <typename prop2_type>
+  struct default_case_<prop2_tag, prop2_type>
+  {
+    typedef mlc::abort_<prop2_tag> ret;
+  };
+  /// \}
+
+} // End of namespace my_lib
+
+// FIXME: Maybe set/get_entry_node should be moved inside a macro?
+namespace stc
+{
+  /// Property 2.
+  /// E is for Exact.
+  template <typename E>
+  struct set_entry_node<E, 2> :
+    public my_lib::switch_<my_lib::prop2_tag,
+			   typename my_lib::vtypes<E>::prop2>::ret
+  {
+  };
+}
+
+
+/*--------------.
+| Client code.  |
+`--------------*/
+
+// Fwd decl.
+namespace client
+{
+  struct foo;
+}
+
+// client::foo's vtypes.
+namespace my_lib
+{
+  template <>
+  struct vtypes<client::foo>
+  {
+    typedef int prop1;
+    typedef double prop2;
+  };
+}
+
+namespace client
+{
+  struct foo : public stc::entry<foo>
+  {
+  };
+}
+
+
+int
+main ()
+{
+  mlc::assert_<mlc_is_a_(client::foo, my_lib::top)>::check();
+
+  mlc::assert_<mlc_is_a_(client::foo, my_lib::property1)>::check();
+  mlc::assert_<mlc_is_a_(client::foo, my_lib::property1a)>::check();
+  mlc::assert_<mlc_is_not_a_(client::foo, my_lib::property1b)>::check();
+
+  mlc::assert_<mlc_is_a_(client::foo, my_lib::property2)>::check();
+  mlc::assert_<mlc_is_not_a_(client::foo, my_lib::property2a)>::check();
+  mlc::assert_<mlc_is_a_(client::foo, my_lib::property2b)>::check();
+}
Index: tests/Makefile.am
--- tests/Makefile.am	(revision 437)
+++ tests/Makefile.am	(working copy)
@@ -8,8 +8,10 @@
 # when oln.m4 is available in the distribution.
 
 check_PROGRAMS =				\
+  entry						\
   properties
 
 properties_SOURCES = properties.cc
+entry_SOURCES = entry.cc
 
 TESTS = $(check_PROGRAMS)
Index: stc/entry.hh
--- stc/entry.hh	(revision 0)
+++ stc/entry.hh	(revision 0)
@@ -0,0 +1,151 @@
+// Copyright (C) 2006 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef STATIC_ENTRY_HH
+# define STATIC_ENTRY_HH
+
+/** \file stc/entry.hh
+    \brief Extensible entry points in a class hierarchy.
+
+    The following simplified diagram shows a typical use of this
+    facility.
+
+	      First hierarchy           Second hierarchy
+
+
+		    /A/                       /B/
+		     ^                         ^
+		     |                         |
+	       ,-----+-----.             ,-----+-----.
+	       |           |             |           |
+	      /A1/        /A2/          /B1/        /B2/
+	       |           |             |           |
+	       o           o             o           o
+		     o                         o
+		     |                         |
+	 stc::set_entry_node<C,1>    stc::set_entry_node<C,2>
+	     (first selector)           (second selector)
+		     ^                         ^
+		     |                         |
+
+		     `------------+------------'
+				  |
+			      stc::entry
+				  ^
+				  |
+				  C
+			   (a client class)
+
+
+   Actually, the inheritance tree is (almost) linear, and the real
+   code rather looks like this:
+
+				 /B/
+				  ^
+				  |
+			    ,-----+-----.
+			    |           |
+			   /B1/        /B2/
+			    |           |
+			    o           o
+				  o
+				  |
+		       stc::set_entry_node<C,2>
+				  ^
+				  |
+				 /A/
+				  ^
+				  |
+			    ,-----+-----.
+			    |           |
+			   /A1/        /A2/
+			    |           |
+			    o           o
+				  o
+				  |
+		       stc::set_entry_node<C,1>
+				  ^
+				  |
+			      stc::entry
+				  ^
+				  |
+				  C
+*/
+
+#include <mlc/if.hh>
+#include <mlc/is_a.hh>
+#include <mlc/comma.hh>
+
+namespace stc
+{
+  namespace internal
+  {
+    // End of the recurring inheritance.
+    struct none {};
+    // No user class should derive from this class.
+    struct not_user_defined {};
+  }
+
+  /** \brief Entry point of a hierarchy.
+      To be possibly specialized by the user.
+
+      This class is use as selector ``plugging'' itself (inheriting)
+      to (from) a bottom class in one of the multiple hierarchies.  */
+  template <typename exact, unsigned num>
+  struct set_entry_node : public internal::not_user_defined
+  {
+    // Nothing.
+  };  
+
+  namespace internal
+  {
+    // Not to be defined by the user.
+    // FIXME: Use a lock?
+    template <typename exact, unsigned num>
+    struct get_entry_node :
+      public set_entry_node<exact, num>,
+      public mlc::if_< mlc_is_a( mlc_comma_1( set_entry_node<exact, num + 1> ),
+				 internal::not_user_defined ),
+		       internal::none,
+		       internal::get_entry_node<exact, num + 1> >::ret
+    {
+    };
+  }
+
+  /** \brief Bottom entry point.
+     
+      This class must not to be specialized by the user.  However,
+      this class is meant to be super class of classes below the
+      multiple hierarchies.  */
+  template <typename exact>
+  struct entry : public internal::get_entry_node<exact, 1>
+  {
+  };
+
+} // end of namespace stc
+
+#endif // ! STATIC_ENTRY_HH
Index: stc/Makefile.am
--- stc/Makefile.am	(revision 437)
+++ stc/Makefile.am	(working copy)
@@ -2,4 +2,5 @@
 
 stcdir = $(includedir)/stc
 nobase_stc_HEADERS =				\
+  entry.hh					\
   properties.hh
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                    
                        https://svn.lrde.epita.fr/svn/oln/trunk/extended
Index: ChangeLog
from  Roland Levillain  <roland(a)lrde.epita.fr>
	Add Metalic's include path to Extended's tests.
	* tests/Makefile.am (AM_CPPFLAGS): Add -I$(top_srcdir)/metalic.
 Makefile.am |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Index: tests/Makefile.am
--- tests/Makefile.am	(revision 436)
+++ tests/Makefile.am	(working copy)
@@ -1,6 +1,6 @@
 ## Process this file through Automake to create Makefile.in -*- Makefile -*-
 
-AM_CPPFLAGS = -I$(top_srcdir)/extended
+AM_CPPFLAGS = -I$(top_srcdir)/extended -I$(top_srcdir)/metalic
 # FIXME: Add 
 #
 #   AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_OPTIMIZE) -ggdb
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                    
                        https://svn.lrde.epita.fr/svn/oln/trunk/metalic
Index: ChangeLog
from  Roland Levillain  <roland(a)lrde.epita.fr>
	* tests/ret.cc (main): Don't write test results on the standard
	output.
 ret.cc |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Index: tests/ret.cc
--- tests/ret.cc	(revision 435)
+++ tests/ret.cc	(working copy)
@@ -1,3 +1,4 @@
+# include <cassert>
 # include <iostream>
 # include <mlc/ret.hh>
 
@@ -12,6 +13,6 @@
 
 int main()
 {
-  std::cout << mlc_bool( mlc::ret_found_in_<yes> ) << std::endl;
-  std::cout << mlc_bool( mlc::ret_found_in_<no>  ) << std::endl;
+  assert(mlc_bool( mlc::ret_found_in_<yes> ) == true);
+  assert(mlc_bool( mlc::ret_found_in_<no>  ) == false);
 }
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                    
                        
https://svn.lrde.epita.fr/svn/oln/trunk/extended
Index: ChangeLog
from  Thierry Geraud  <theo(a)lrde.epita.fr>
	First draft of extended functions.
	* xtd/math.hh: New file.
	* xtd/res.hh: New file.
	* xtd/cast.hh: New file.
	* xtd/math: New file.
	* xtd/math/trigo.hh: New file.
	* xtd/math/arith.hh: New file.
	* xtd/math/id.hh: New file.
	* xtd/mexpr.hh: New file.
	* xtd/args.hh: New file.
	* xtd/literal.hh: New file.
	* xtd/ops_expr.hh: New file.
	* xtd/abstract: New file.
	* xtd/abstract/nary_fun.hh: New file.
	* xtd/abstract/exact.hh: New file.
	* xtd/abstract/fun_expr.hh: New file.
	* xtd/abstract/any.hh: New file.
	* xtd/abstract/fun.hh: New file.
	* xtd/abstract/plain_fun.hh: New file.
	* xtd/abstract/meta_fun.hh: New file.
	* xtd/mfun.hh: New file.
	* xtd/traits.hh: New file.
	* xtd/builtin: New file.
	* xtd/builtin/traits.hh: New file.
	* xtd/arg.hh: New file.
	* xtd/case.hh: New file.
	* tests/id.cc: New file.
	* tests/cos.cc: New file.
	* tests/cast.cc: New file.
	* tests/Makefile.am: Update.
 tests/Makefile.am         |   13 +
 tests/cast.cc             |   37 ++++
 tests/cos.cc              |   52 +++++
 tests/id.cc               |   43 ++++
 xtd/abstract/any.hh       |   67 +++++++
 xtd/abstract/exact.hh     |   93 ++++++++++
 xtd/abstract/fun.hh       |   58 ++++++
 xtd/abstract/fun_expr.hh  |  225 +++++++++++++++++++++++++
 xtd/abstract/meta_fun.hh  |  290 ++++++++++++++++++++++++++++++++
 xtd/abstract/nary_fun.hh  |   53 +++++
 xtd/abstract/plain_fun.hh |  271 ++++++++++++++++++++++++++++++
 xtd/arg.hh                |  152 ++++++++++++++++
 xtd/args.hh               |  179 +++++++++++++++++++
 xtd/builtin/traits.hh     |   90 ++++++++++
 xtd/case.hh               |   37 ++++
 xtd/cast.hh               |  126 ++++++++++++++
 xtd/literal.hh            |  113 ++++++++++++
 xtd/math.hh               |   45 +++++
 xtd/math/arith.hh         |  104 +++++++++++
 xtd/math/id.hh            |   68 +++++++
 xtd/math/trigo.hh         |  154 +++++++++++++++++
 xtd/mexpr.hh              |  413 ++++++++++++++++++++++++++++++++++++++++++++++
 xtd/mfun.hh               |  195 +++++++++++++++++++++
 xtd/ops_expr.hh           |   84 +++++++++
 xtd/res.hh                |  292 ++++++++++++++++++++++++++++++++
 xtd/traits.hh             |   55 ++++++
 26 files changed, 3308 insertions(+), 1 deletion(-)
Index: xtd/math.hh
--- xtd/math.hh	(revision 0)
+++ xtd/math.hh	(revision 0)
@@ -0,0 +1,45 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_MATH_HH
+# define EXTENDED_MATH_HH
+
+# include <cmath>
+
+# include <xtd/abstract/plain_fun.hh>
+# include <xtd/mfun.hh>
+# include <xtd/arg.hh>
+# include <xtd/ops_expr.hh>
+
+# include <xtd/math/id.hh>
+# include <xtd/math/trigo.hh>
+# include <xtd/math/arith.hh>
+// # include <xtd/math/logic.hh>
+
+
+
+#endif // ! EXTENDED_MATH_HH
Index: xtd/res.hh
--- xtd/res.hh	(revision 0)
+++ xtd/res.hh	(revision 0)
@@ -0,0 +1,292 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_RES_HH
+# define EXTENDED_RES_HH
+
+# include <mlc/flags.hh>
+# include <mlc/bool.hh> // FIXME: should be assert.hh
+# include <mlc/if.hh>
+# include <mlc/is_a.hh>
+# include <mlc/comma.hh>
+# include <mlc/cmp.hh>
+# include <mlc/ret.hh>
+
+# include <xtd/abstract/nary_fun.hh>
+
+
+
+// forward declarations ...............................
+
+namespace xtd
+{
+
+  namespace abstract
+  {
+
+    template <typename E>
+    class meta_fun_;
+
+    template <unsigned n, typename E>
+    class meta_nary_fun_;
+
+    template <typename E>
+    class fun_expr_;
+
+  } // end of namespace xtd::abstract
+
+  template <typename F,
+	    typename Expr>
+  struct m1expr;
+
+  template <typename F,
+	    typename Expr1, typename Expr2>
+  struct m2expr;
+
+  template <typename F,
+	    typename Expr1, typename Expr2, typename Expr3>
+  struct m3expr;
+
+} // end of namespace xtd
+
+
+// end of forward declarations ........................
+
+
+
+
+// macros
+
+# define xtd_res_0(F)                 typename xtd::internal::get_res_<F>::ret
+# define xtd_res_1(F, A1)             typename xtd::internal::get_res_<F, A1>::ret
+# define xtd_res_2(F, A1, A2)         typename xtd::internal::get_res_<F, A1, A2>::ret
+# define xtd_res_3(F, A1, A2, A3)     typename xtd::internal::get_res_<F, A1, A2, A3>::ret
+
+# define xtd_expr_res(F, Args)        typename xtd::internal::get_expr_res_<F, Args>::ret
+
+
+namespace xtd
+{
+
+  namespace ERROR
+  {
+    struct THE_MACRO_xtd_res_0_IS_FOR_USE_ON_AN_xtd_meta_fun;
+    struct THE_MACRO_xtd_res_1_IS_FOR_USE_ON_AN_xtd_meta_fun;
+    struct THE_MACRO_xtd_res_2_IS_FOR_USE_ON_AN_xtd_meta_fun;
+    struct THE_MACRO_xtd_res_3_IS_FOR_USE_ON_AN_xtd_meta_fun;
+
+    struct THE_MACRO_xtd_expr_res_IS_FOR_USE_ON_AN_xtd_fun_expr;
+    struct THE_MACRO_xtd_expr_res_IS_FOR_USE_WITH_AN_xtd_args;
+
+    struct THE_MACRO_xtd_res_0_IS_FOR_USE_ON_AN_xtd_meta_nary_fun_WITH_n_BEING_0;
+    struct THE_MACRO_xtd_res_1_IS_FOR_USE_ON_AN_xtd_meta_nary_fun_WITH_n_BEING_1;
+    struct THE_MACRO_xtd_res_2_IS_FOR_USE_ON_AN_xtd_meta_nary_fun_WITH_n_BEING_2;
+    struct THE_MACRO_xtd_res_3_IS_FOR_USE_ON_AN_xtd_meta_nary_fun_WITH_n_BEING_3;
+
+    struct SPECIALIZATION_OF_xtd_res_NOT_FOUND;
+    struct SPECIALIZATION_OF_xtd_expr_res_NOT_FOUND;
+
+    struct NO_ret_FOUND_IN_THE_SPECIALIZATION_OF_xtd_res;
+    struct NO_ret_FOUND_IN_THE_SPECIALIZATION_OF_xtd_expr_res;
+
+    struct YOU_SHOULD_NOT_DERIVE_DIRECTLY_FROM_xtd_meta_fun_BUT_FROM_xtd_meta_nary_fun_;
+
+    struct FIXME_NAME_THIS_ERROR ;
+
+  } // end of namespace xtd::ERROR
+
+
+
+
+  // FIXME: doc
+
+  template <typename F,
+	    typename A1 = mlc::none,
+	    typename A2 = mlc::none,
+	    typename A3 = mlc::none>
+  struct res_ : public mlc::undefined
+  {
+  };
+
+
+  template <typename F,
+	    typename Args>
+  struct expr_res_ : public mlc::undefined
+  {
+  };
+
+
+
+  namespace internal
+  {
+    // FIXME: doc...
+
+
+    // for meta_fun that are *not* fun_expr
+    // ------------------------------------
+
+
+    // three args
+
+    template <typename F,
+	      typename A1 = mlc::none,
+	      typename A2 = mlc::none,
+	      typename A3 = mlc::none>
+    struct do_get_res_
+
+      : private mlc::assert_< mlc_is_a(F, xtd::abstract::meta_fun_),
+ 			      xtd::ERROR::THE_MACRO_xtd_res_3_IS_FOR_USE_ON_AN_xtd_meta_fun >,
+      
+	private mlc::assert_< mlc::and_< mlc_is_a(F, xtd::abstract::meta_fun_),
+					 mlc_is_a(F, xtd::abstract::nary_fun_<3>) >,
+			      xtd::ERROR::THE_MACRO_xtd_res_3_IS_FOR_USE_ON_AN_xtd_meta_nary_fun_WITH_n_BEING_3 >,
+
+	private mlc::assert_< mlc_is_not_a(mlc_comma_3(xtd::res_<F,A1,A2,A3>), mlc::undefined),
+			      xtd::ERROR::SPECIALIZATION_OF_xtd_res_NOT_FOUND >,
+
+	private mlc::assert_< mlc::neq_< mlc_ret(mlc_comma_3(xtd::res_<F,A1,A2,A3>)), mlc::not_found >,
+                              xtd::ERROR::NO_ret_FOUND_IN_THE_SPECIALIZATION_OF_xtd_res >
+    {
+      typedef mlc_ret(mlc_comma_3(xtd::res_<F,A1,A2,A3>)) ret;
+    };
+
+
+
+    // no arg
+
+    template <typename F>
+    struct do_get_res_< F >
+
+      : private mlc::assert_< mlc_is_a(F, xtd::abstract::meta_fun_),
+ 			      xtd::ERROR::THE_MACRO_xtd_res_0_IS_FOR_USE_ON_AN_xtd_meta_fun >,
+      
+	private mlc::assert_< mlc::and_< mlc_is_a(F, xtd::abstract::meta_fun_),
+					 mlc_is_a(F, xtd::abstract::nary_fun_<0>) >,
+			      xtd::ERROR::THE_MACRO_xtd_res_0_IS_FOR_USE_ON_AN_xtd_meta_nary_fun_WITH_n_BEING_0 >,
+
+	private mlc::assert_< mlc_is_not_a(xtd::res_<F>, mlc::undefined),
+			      xtd::ERROR::SPECIALIZATION_OF_xtd_res_NOT_FOUND >,
+
+	private mlc::assert_< mlc::neq_< mlc_ret(xtd::res_<F>), mlc::not_found >,
+                              xtd::ERROR::NO_ret_FOUND_IN_THE_SPECIALIZATION_OF_xtd_res >
+    {
+      typedef mlc_ret(xtd::res_<F>) ret;
+    };
+
+
+    // a single arg
+
+    template <typename F, typename A1>
+    struct do_get_res_< F, A1 >
+
+      : private mlc::assert_< mlc_is_a(F, xtd::abstract::meta_fun_),
+ 			      xtd::ERROR::THE_MACRO_xtd_res_1_IS_FOR_USE_ON_AN_xtd_meta_fun >,
+      
+	private mlc::assert_< mlc::and_< mlc_is_a(F, xtd::abstract::meta_fun_),
+					 mlc_is_a(F, xtd::abstract::nary_fun_<1>) >,
+			      xtd::ERROR::THE_MACRO_xtd_res_1_IS_FOR_USE_ON_AN_xtd_meta_nary_fun_WITH_n_BEING_1 >,
+
+	private mlc::assert_< mlc_is_not_a(mlc_comma_1(xtd::res_<F,A1>), mlc::undefined),
+			      xtd::ERROR::SPECIALIZATION_OF_xtd_res_NOT_FOUND >,
+
+	private mlc::assert_< mlc::neq_< mlc_ret(mlc_comma_1(xtd::res_<F,A1>)), mlc::not_found >,
+                              xtd::ERROR::NO_ret_FOUND_IN_THE_SPECIALIZATION_OF_xtd_res >
+    {
+      typedef mlc_ret(mlc_comma_1(xtd::res_<F,A1>)) ret;
+    };
+
+
+    // a couple of args
+
+    template <typename F, typename A1, typename A2>
+    struct do_get_res_< F, A1, A2 >
+
+      : private mlc::assert_< mlc_is_a(F, xtd::abstract::meta_fun_),
+ 			      xtd::ERROR::THE_MACRO_xtd_res_2_IS_FOR_USE_ON_AN_xtd_meta_fun >,
+      
+	private mlc::assert_< mlc::and_< mlc_is_a(F, xtd::abstract::meta_fun_),
+					 mlc_is_a(F, xtd::abstract::nary_fun_<2>) >,
+			      xtd::ERROR::THE_MACRO_xtd_res_2_IS_FOR_USE_ON_AN_xtd_meta_nary_fun_WITH_n_BEING_2 >,
+
+	private mlc::assert_< mlc_is_not_a(mlc_comma_2(xtd::res_<F,A1,A2>), mlc::undefined),
+			      xtd::ERROR::SPECIALIZATION_OF_xtd_res_NOT_FOUND >,
+
+	private mlc::assert_< mlc::neq_< mlc_ret(mlc_comma_2(xtd::res_<F,A1,A2>)), mlc::not_found >,
+                              xtd::ERROR::NO_ret_FOUND_IN_THE_SPECIALIZATION_OF_xtd_res >
+    {
+      typedef mlc_ret(mlc_comma_2(xtd::res_<F,A1,A2>)) ret;
+    };
+
+
+
+    // for meta_fun that *are* fun_expr
+    // ------------------------------------
+
+    template <typename F,
+	      typename Args>
+    struct get_expr_res_
+
+      : private mlc::assert_< mlc_is_a(F, xtd::abstract::fun_expr_),
+ 			      xtd::ERROR::THE_MACRO_xtd_expr_res_IS_FOR_USE_ON_AN_xtd_fun_expr >,
+
+        private mlc::assert_< mlc_is_a(Args, xtd::abstract::args),
+ 			      xtd::ERROR::THE_MACRO_xtd_expr_res_IS_FOR_USE_WITH_AN_xtd_args >,
+
+        private mlc::assert_< mlc_is_not_a(mlc_comma_1(xtd::expr_res_<F,Args>), mlc::undefined),
+			      xtd::ERROR::SPECIALIZATION_OF_xtd_expr_res_NOT_FOUND >,
+
+	private mlc::assert_< mlc::neq_< mlc_ret(mlc_comma_1(xtd::expr_res_<F,Args>)), mlc::not_found >,
+                              xtd::ERROR::NO_ret_FOUND_IN_THE_SPECIALIZATION_OF_xtd_expr_res >
+    {
+      typedef mlc_ret(mlc_comma_1(xtd::expr_res_<F,Args>)) ret;
+    };
+
+
+
+    // get_res_ is the entry point
+    // ------------------------------------
+
+    template <typename F,
+	      typename A1 = mlc::none,
+	      typename A2 = mlc::none,
+	      typename A3 = mlc::none>
+    struct get_res_ : public mlc::if_< mlc_is_a(F, xtd::abstract::fun_expr_),
+				       get_expr_res_<F, xtd::args_<A1, A2, A3> >,
+				       do_get_res_<F, A1, A2, A3> >::ret
+    {};
+
+    // FIXME: add extra assertions here(?)
+    
+
+
+  } // end of namespace xtd::internal
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_RES_HH
Index: xtd/cast.hh
--- xtd/cast.hh	(revision 0)
+++ xtd/cast.hh	(revision 0)
@@ -0,0 +1,126 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_CAST_HH
+# define EXTENDED_CAST_HH
+
+# include <mlc/pair.hh>
+
+# include <xtd/abstract/plain_fun.hh>
+# include <xtd/abstract/meta_fun.hh>
+# include <xtd/mexpr.hh>
+
+
+
+namespace xtd
+{
+
+  /*! \class xtd::plain_cast_<Dest>
+  **
+  ** FIXME: doc
+  */
+
+  template <typename Dest, typename Src> struct plain_cast_; // fwd decl
+
+  template <typename Dest, typename Src>
+  struct fun_traits_< plain_cast_<Dest, Src> >
+  {
+    typedef Src arg_type;
+    typedef Dest res_type;
+  };
+  
+  template <typename Dest, typename Src>
+  struct plain_cast_ : public abstract::plain_nary_fun_< 1, plain_cast_<Dest, Src> >
+  {
+    Dest impl_op(const Src& arg) const
+    {
+      return Dest(arg);
+    }
+  };
+
+
+
+
+  // equipment for xtd::meta_cast_<Dest>
+
+  template <typename Dest> struct meta_cast_; // fwd decl
+
+  template <typename Dest, typename A>
+  struct res_< meta_cast_<Dest>, A >
+  {
+    typedef Dest ret;
+  };
+
+
+  /*! \class xtd::meta_cast_<Dest>
+  **
+  ** FIXME: doc
+  */
+
+  template <typename Dest>
+  struct meta_cast_ : public abstract::meta_nary_fun_< 1, meta_cast_<Dest> >
+  {
+    template <typename A>
+    Dest impl_calc(const A& a) const
+      // ---------
+    {
+      return Dest(a);
+    }
+  };
+
+
+
+  /*! \function xtd::cast_<Dest>(arg)
+  **
+  ** This function mimics the behavior of the method:
+  **
+  **    xtd::meta_nary_fun_<1, E>::operator(const A& a)
+  **
+  ** The method is thus turned into a function where E, the
+  ** unary meta function actually is meta_cast_<Dest>.
+  */
+
+  template <typename Dest, typename A>
+  typename xtd::case_< xtd::tag::meta_1ary_fun_operator,
+		       mlc::pair_< meta_cast_<Dest>,
+				   A >
+                     >::ret::res
+  cast_(const A& a)
+  {
+    typedef typename xtd::case_< xtd::tag::meta_1ary_fun_operator,
+                                 mlc::pair_< meta_cast_<Dest>, A> >::ret case_t;
+    static const meta_cast_<Dest> the_;
+    return case_t::impl(&the_, a);
+  }
+
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_CAST_HH
Index: xtd/math/trigo.hh
--- xtd/math/trigo.hh	(revision 0)
+++ xtd/math/trigo.hh	(revision 0)
@@ -0,0 +1,154 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_MATH_TRIGO_HH
+# define EXTENDED_MATH_TRIGO_HH
+
+# include <cmath>
+
+# include <mlc/assert.hh>
+# include <mlc/logic.hh>
+# include <mlc/cmp.hh>
+
+# include <xtd/abstract/plain_fun.hh>
+# include <xtd/mfun.hh>
+
+
+
+
+
+// FIXME: macro doc!
+
+# define xtd_decl_trigo_fun(FunName)									\
+													\
+  template <typename T> struct FunName##_;								\
+													\
+  template <typename T>											\
+  struct fun_traits_< FunName##_<T> >									\
+													\
+    : private mlc::assert_< mlc::or_list_< mlc::eq_<T, float>,						\
+					   mlc::eq_<T, double>,						\
+					   mlc::eq_<T, long double> >,					\
+			    xtd::ERROR::TRIGONOMETRY_ONLY_RUNS_ON_float_OR_double_OR_long_double >	\
+  {													\
+    typedef mlc::dummy arg_type;									\
+    typedef mlc::dummy res_type;									\
+  };													\
+													\
+  template <>												\
+  struct fun_traits_< FunName##_<float> >								\
+  {													\
+    typedef float arg_type;										\
+    typedef float res_type;										\
+  };													\
+													\
+  template <>												\
+  struct fun_traits_< FunName##_<double> >								\
+  {													\
+    typedef double arg_type;										\
+    typedef double res_type;										\
+  };													\
+													\
+  template <>												\
+  struct fun_traits_< FunName##_<long double> >								\
+  {													\
+    typedef long double arg_type;									\
+    typedef long double res_type;									\
+  };													\
+													\
+  template <typename T>											\
+  struct FunName##_ : public abstract::trigo_< T, FunName##_<T> >					\
+  {													\
+    typedef FunName##_<T> self;										\
+													\
+    xtd_res(self) impl_op(const T& arg) const								\
+    {													\
+      return std::FunName(arg);										\
+    }													\
+  };													\
+													\
+  const FunName##_<float> f##FunName;									\
+  const FunName##_<double> d##FunName;									\
+  const FunName##_<long double> ld##FunName;								\
+													\
+  typedef m1fun_<FunName##_> FunName##_type;								\
+  const FunName##_type FunName;										\
+													\
+  struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_o_n
+
+
+
+namespace xtd
+{
+
+  namespace ERROR
+  {
+
+    struct TRIGONOMETRY_ONLY_RUNS_ON_float_OR_double_OR_long_double;
+
+  } // end of namespace xtd::ERROR
+
+
+  namespace abstract
+  {
+
+    template <typename T, typename E>
+    struct trigo_ :
+
+      private mlc::assert_< mlc::or_list_< mlc::eq_<T, float>,
+					   mlc::eq_<T, double>,
+					   mlc::eq_<T, long double> >,
+			    xtd::ERROR::TRIGONOMETRY_ONLY_RUNS_ON_float_OR_double_OR_long_double >,
+
+      public abstract::plain_nary_fun_< 1, E >
+    {
+    protected:
+      trigo_() {}
+    };
+
+
+  } // end of namespace xtd::abstract
+
+
+  xtd_decl_trigo_fun(cos);
+  xtd_decl_trigo_fun(sin);
+  xtd_decl_trigo_fun(tan);
+
+  xtd_decl_trigo_fun(acos);
+  xtd_decl_trigo_fun(asin);
+  xtd_decl_trigo_fun(atan);
+
+  xtd_decl_trigo_fun(cosh);
+  xtd_decl_trigo_fun(sinh);
+  xtd_decl_trigo_fun(tanh);
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_COS_HH
Index: xtd/math/arith.hh
--- xtd/math/arith.hh	(revision 0)
+++ xtd/math/arith.hh	(revision 0)
@@ -0,0 +1,104 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_MATH_ARITH_HH
+# define EXTENDED_MATH_ARITH_HH
+
+# include <xtd/builtin/traits.hh>
+# include <xtd/abstract/plain_fun.hh>
+# include <xtd/mfun.hh>
+
+
+
+namespace xtd
+{
+
+
+  /*! \class xtd::plain_plus_<T>
+  **
+  ** FIXME: doc
+  */
+
+  template <typename T1, typename T2> struct plain_plus_; // fwd decl
+
+  template <typename T1, typename T2>
+  struct fun_traits_< plain_plus_<T1, T2> >
+  {
+    typedef T1 arg1_type;
+    typedef T2 arg2_type;
+    typedef xtd_plus(T1, T2) res_type;
+  };
+  
+  template <typename T1, typename T2>
+  struct plain_plus_ : public abstract::plain_nary_fun_< 2, plain_plus_<T1, T2> >
+  {
+    typedef plain_plus_<T1, T2> self;
+    xtd_res(self) impl_op(const T1& arg1, const T2& arg2) const
+    {
+      return arg1 + arg2;
+    }
+  };
+
+  typedef m2fun_<plain_plus_> plus_type;
+  const plus_type plus;
+
+
+
+  /*! \class xtd::plain_mult_<T>
+  **
+  ** FIXME: doc
+  */
+
+  template <typename T1, typename T2> struct plain_mult_; // fwd decl
+
+  template <typename T1, typename T2>
+  struct fun_traits_< plain_mult_<T1, T2> >
+  {
+    typedef T1 arg1_type;
+    typedef T2 arg2_type;
+    typedef xtd_mult(T1, T2) res_type;
+  };
+  
+  template <typename T1, typename T2>
+  struct plain_mult_ : public abstract::plain_nary_fun_< 2, plain_mult_<T1, T2> >
+  {
+    typedef plain_mult_<T1, T2> self;
+    xtd_res(self) impl_op(const T1& arg1, const T2& arg2) const
+    {
+      return arg1 * arg2;
+    }
+  };
+
+  typedef m2fun_<plain_mult_> mult_type;
+  const mult_type mult;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_ARITH_HH
Index: xtd/math/id.hh
--- xtd/math/id.hh	(revision 0)
+++ xtd/math/id.hh	(revision 0)
@@ -0,0 +1,68 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_MATH_ID_HH
+# define EXTENDED_MATH_ID_HH
+
+# include <xtd/abstract/plain_fun.hh>
+# include <xtd/mfun.hh>
+
+
+namespace xtd
+{
+
+  /*! \class xtd::plain_id_<T>
+  **
+  ** FIXME: doc
+  */
+
+  template <typename T> struct plain_id_; // fwd decl
+
+  template <typename T>
+  struct fun_traits_< plain_id_<T> >
+  {
+    typedef T arg_type;
+    typedef T res_type;
+  };
+  
+  template <typename T>
+  struct plain_id_ : public abstract::plain_nary_fun_< 1, plain_id_<T> >
+  {
+    T impl_op(const T& arg) const
+    {
+      return arg;
+    }
+  };
+
+  // id
+  const m1fun_<plain_id_> id;
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_ID_HH
Index: xtd/mexpr.hh
--- xtd/mexpr.hh	(revision 0)
+++ xtd/mexpr.hh	(revision 0)
@@ -0,0 +1,413 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_MEXPR_HH
+# define EXTENDED_MEXPR_HH
+
+# include <mlc/case.hh>
+# include <mlc/assert.hh>
+# include <mlc/is_a.hh>
+
+# include <xtd/args.hh>
+# include <xtd/res.hh>
+# include <xtd/abstract/nary_fun.hh>
+# include <xtd/abstract/fun_expr.hh>
+
+
+
+
+
+namespace xtd
+{
+
+  namespace ERROR
+  {
+
+    struct FIXME;
+
+  } // end of namespace xtd::ERROR
+
+
+
+  // FIXME: temporary code; move it elsewhere!
+
+  template <unsigned n1, unsigned n2>
+  struct n_max {
+    static const unsigned ret = (n1 > n2 ? n1 : n2);
+  };
+
+
+
+  // m0expr_
+
+  template <typename F>
+  struct m0expr_;
+
+  
+  template <typename F>
+  struct nargs_< m0expr_<F> >
+  {
+    static const unsigned ret = 0;
+  };
+
+
+  template <typename F, typename Args>
+  struct expr_res_< m0expr_<F>, Args >
+  {
+    // f()
+    typedef xtd_res_0(F) ret;
+  };
+
+
+  template <typename F>
+  struct m0expr_
+
+    : public abstract::nary_fun_expr_< 0, m0expr_<F> >
+  {
+    const F f;
+
+    m0expr_() :
+      f()
+    {}
+
+    m0expr_(const F& f) :
+     f(f)
+    {
+      mlc::assert_< mlc_is_a(F, abstract::nary_fun_<0>),
+	            ERROR::FIXME >::check();
+    }
+
+    template <typename Args>
+    xtd_res_0(F) impl_eval(const Args& as) const
+    {
+      return f();
+    }
+  };
+
+
+
+  // m1expr_
+
+  template <typename F,
+	    typename Expr>
+  struct m1expr_;
+
+  
+  template <typename F,
+	    typename Expr>
+  struct nargs_< m1expr_<F, Expr> >
+  {
+    static const unsigned ret = xtd_nargs(Expr);
+  };
+
+
+  template <typename F,
+	    typename Expr,
+	    typename Args>
+  struct expr_res_< m1expr_<F, Expr>,
+		    Args >
+  {
+    // f(expr.eval(as))
+    typedef xtd_expr_res(Expr, Args) eval_t;
+    typedef xtd_res_1(F, eval_t) ret;
+  };
+
+
+  template <typename F,
+	    typename Expr>
+  struct m1expr_
+
+    : public abstract::nary_fun_expr_< xtd_nargs(Expr),
+				       m1expr_<F, Expr> >
+  {
+    typedef m1expr_<F, Expr> self;
+
+    const F f;
+    const Expr expr;
+
+    m1expr_() :
+      f(),
+      expr()
+    {}
+
+    m1expr_(const abstract::fun_expr_<Expr>& expr) :
+      f(),
+      expr(exact_of(expr))
+    {}
+
+    m1expr_(const F& f,
+	    const abstract::fun_expr_<Expr>& expr) :
+      f(f),
+      expr(exact_of(expr))
+    {
+      mlc::assert_< mlc_is_a(F, abstract::nary_fun_<1>),
+	            ERROR::FIXME >::check();
+    }
+
+    template <typename Args>
+    xtd_expr_res(self, Args) impl_eval(const Args& as) const
+    {
+      return f(expr.eval(as));
+    }
+  };
+
+
+
+
+  // m2expr_
+
+
+  template <typename F,
+	    typename Expr1, typename Expr2>
+  struct m2expr_;
+
+
+  template <typename F,
+	    typename Expr1, typename Expr2>
+  struct nargs_< m2expr_<F, Expr1, Expr2> >
+  {
+    static const unsigned ret = n_max< xtd_nargs(Expr1),
+				       xtd_nargs(Expr2) >::ret;
+  };
+
+
+  template <typename F,
+	    typename Expr1, typename Expr2,
+	    typename Args>
+  struct expr_res_< m2expr_<F, Expr1, Expr2>,
+		    Args >
+  {
+    // f(expr1.eval(as), expr2.eval(as))
+    typedef xtd_expr_res(Expr1, Args) eval1_t;
+    typedef xtd_expr_res(Expr2, Args) eval2_t;
+    typedef xtd_res_2(F, eval1_t, eval2_t) ret;
+  };
+
+
+  template <typename F,
+	    typename Expr1, typename Expr2>
+  struct m2expr_
+
+    : public abstract::nary_fun_expr_< xtd_nargs(mlc_comma_2(m2expr_<F, Expr1, Expr2>)),
+				       m2expr_<F, Expr1, Expr2> >
+  {
+    typedef m2expr_<F, Expr1, Expr2> self;
+
+    const F f;
+    const Expr1 expr1;
+    const Expr2 expr2;
+
+    m2expr_() :
+      f(),
+      expr1(),
+      expr2()
+    {}
+
+    m2expr_(const abstract::fun_expr_<Expr1>& expr1,
+	    const abstract::fun_expr_<Expr2>& expr2) :
+      f(),
+      expr1(exact_of(expr1)),
+      expr2(exact_of(expr2))
+    {}
+
+    m2expr_(const F& f,
+	    const abstract::fun_expr_<Expr1>& expr1,
+	    const abstract::fun_expr_<Expr2>& expr2) :
+      f(f),
+      expr1(exact_of(expr1)),
+      expr2(exact_of(expr2))
+    {
+      mlc::assert_< mlc_is_a(F, abstract::nary_fun_<2>),
+	            ERROR::FIXME >::check();
+    }
+
+    template <typename Args>
+    xtd_expr_res(self, Args) impl_eval(const Args& as) const
+    {
+      return f(expr1.eval(as), expr2.eval(as));
+    }
+  };
+
+
+
+  // m3expr_
+
+  template <typename F,
+	    typename Expr1, typename Expr2, typename Expr3>
+  struct m3expr_;
+
+
+  template <typename F,
+	    typename Expr1, typename Expr2, typename Expr3>
+  struct nargs_< m3expr_<F, Expr1, Expr2, Expr3> >
+  {
+    static const unsigned ret = n_max< xtd_nargs(Expr1),
+				       n_max< xtd_nargs(Expr2),
+					      xtd_nargs(Expr3) >::ret >::ret;
+  };
+
+
+  template <typename F,
+	    typename Expr1, typename Expr2, typename Expr3,
+	    typename Args>
+  struct expr_res_< m3expr_<F, Expr1, Expr2, Expr3>,
+		    Args >
+  {
+    // f(expr1.eval(as), expr2.eval(as), expr3.eval(as))
+    typedef xtd_expr_res(Expr1, Args) eval1_t;
+    typedef xtd_expr_res(Expr2, Args) eval2_t;
+    typedef xtd_expr_res(Expr3, Args) eval3_t;
+    typedef xtd_res_3(F, eval1_t, eval2_t, eval3_t) ret;
+  };
+
+
+  template <typename F,
+	    typename Expr1, typename Expr2, typename Expr3>
+  struct m3expr_
+
+    : public abstract::nary_fun_expr_< xtd_nargs(mlc_comma_3(m3expr_<F, Expr1, Expr2, Expr3>)),
+				       m3expr_<F, Expr1, Expr2, Expr3> >
+  {
+    typedef m3expr_<F, Expr1, Expr2, Expr3> self;
+
+    const F f;
+    const Expr1 expr1;
+    const Expr2 expr2;
+    const Expr3 expr3;
+
+    m3expr_() :
+      f(),
+      expr1(),
+      expr2(),
+      expr3()
+    {}
+
+    m3expr_(const abstract::fun_expr_<Expr1>& expr1,
+	    const abstract::fun_expr_<Expr2>& expr2,
+	    const abstract::fun_expr_<Expr3>& expr3) :
+      f(),
+      expr1(exact_of(expr1)),
+      expr2(exact_of(expr2)),
+      expr3(exact_of(expr3))
+    {}
+
+    m3expr_(const F& f,
+	    const abstract::fun_expr_<Expr1>& expr1,
+	    const abstract::fun_expr_<Expr2>& expr2,
+	    const abstract::fun_expr_<Expr3>& expr3) :
+      f(f),
+      expr1(exact_of(expr1)),
+      expr2(exact_of(expr2)),
+      expr3(exact_of(expr3))
+    {
+      mlc::assert_< mlc_is_a(F, abstract::nary_fun_<3>),
+	            ERROR::FIXME >::check();
+    }
+
+    template <typename Args>
+    xtd_expr_res(self, Args) impl_eval(const Args& as) const
+    {
+      return f(expr1.eval(as), expr2.eval(as), expr3.eval(as));
+    }
+  };
+
+
+
+
+
+  // meta_nary_fun_<1, F>::operator()(abstract::fun_expr_<Expr>& expr) const
+
+  template <typename F, typename Expr>
+  struct case_< tag::meta_1ary_fun_operator,
+		mlc::pair_<F, Expr>,
+		1 >
+    : public mlc::where_< mlc_is_a(Expr, abstract::fun_expr_) >
+  {
+    typedef m1expr_<F, Expr> res;
+
+    static res impl(const abstract::meta_nary_fun_<1, F>* this_,
+		    const abstract::fun_expr_<Expr>& expr)
+    {
+      res tmp(exact_of(*this_), expr);
+      return tmp;
+    }
+  };
+
+
+  //   meta_nary_fun_<2, F>::operator()(const fun_expr_<Expr1>& expr1,
+  // 				        const fun_expr_<Expr2>& expr2) const
+
+  template <typename F, typename Expr1, typename Expr2>
+  struct case_< tag::meta_2ary_fun_operator,
+		mlc::valist_<F, Expr1, Expr2>,
+		1 >
+    : public mlc::where_< mlc::and_< mlc_is_a(Expr1, abstract::fun_expr_),
+				     mlc_is_a(Expr2, abstract::fun_expr_) > >
+  {
+    typedef m2expr_<F, Expr1, Expr2> res;
+
+    static res impl(const abstract::meta_nary_fun_<2, F>* this_,
+		    const abstract::fun_expr_<Expr1>& expr1,
+		    const abstract::fun_expr_<Expr2>& expr2)
+    {
+      res tmp(exact_of(*this_), expr1, expr2);
+      return tmp;
+    }
+  };
+
+
+  //   meta_nary_fun_<3, F>::operator()(const fun_expr_<Expr1>& expr1,
+  // 				        const fun_expr_<Expr2>& expr2,
+  // 				        const fun_expr_<Expr3>& expr3) const
+
+  template <typename F, typename Expr1, typename Expr2, typename Expr3>
+  struct case_< tag::meta_3ary_fun_operator,
+		mlc::valist_<F, Expr1, Expr2, Expr3>,
+		1 >
+    : public mlc::where_< mlc::and_< mlc_is_a(Expr1, abstract::fun_expr_),
+			  mlc::and_< mlc_is_a(Expr2, abstract::fun_expr_),
+				     mlc_is_a(Expr3, abstract::fun_expr_) > > >
+  {
+    typedef m3expr_<F, Expr1, Expr2, Expr3> res;
+
+    static res impl(const abstract::meta_nary_fun_<3, F>* this_,
+		    const abstract::fun_expr_<Expr1>& expr1,
+		    const abstract::fun_expr_<Expr2>& expr2,
+		    const abstract::fun_expr_<Expr3>& expr3)
+    {
+      res tmp(exact_of(*this_), expr1, expr2, expr3);
+      return tmp;
+    }
+  };
+
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MEXPR_HH
Index: xtd/args.hh
--- xtd/args.hh	(revision 0)
+++ xtd/args.hh	(revision 0)
@@ -0,0 +1,179 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_ARGS_HH
+# define EXTENDED_ARGS_HH
+
+# include <mlc/flags.hh>
+
+
+
+// FIXME: doc
+// FIXME: this code should be rewritten to check that 
+// FIXME: xtd::nargs_<F>::ret is properly defined; see for
+// FIXME: instance, the code of xtd_res or xtd_arg1...
+
+# define xtd_nargs(F) xtd::nargs_<F>::ret
+
+
+
+namespace xtd
+{
+
+  namespace abstract
+  {
+    /*! \class xtd::abstract::args
+    **
+    ** FIXME: Abstract base class for args_<..>
+    */
+
+    struct args
+    {
+    protected:
+      args() {}
+    };
+
+  } // end of namespace xtd::abstract
+
+
+
+
+  /*! \class xtd::nargs_<F>
+  **
+  ** FIXME: doc
+  ** FIXME: and add a mechanism so that the type of F is checked
+  ** FIXME: Cf. get_res0_ in xtd/abstract/meta_fun.hh 
+  */
+
+  template <typename F>
+  struct nargs_;
+
+
+
+
+  /*! \class xtd::args_<A1, ..>
+  **
+  ** FIXME: to pack arguments
+  */
+
+  // three args
+
+  template <typename A1 = mlc::none,
+	    typename A2 = mlc::none,
+	    typename A3 = mlc::none>
+  struct args_ : public abstract::args
+  {
+    args_(const A1& arg1, const A2& arg2, const A3& arg3)
+      : arg1(arg1),
+	arg2(arg2),
+	arg3(arg3)
+    {}
+    const A1 arg1;
+    const A2 arg2;
+    const A3 arg3;
+    typedef A1 arg1_type;
+    typedef A2 arg2_type;
+    typedef A3 arg3_type;
+  };
+
+  template <typename A1, typename A2, typename A3>
+  args_<A1,A2,A3> mk_args(const A1& arg1, const A2& arg2, const A3& arg3)
+  {
+    args_<A1,A2,A3> tmp(arg1, arg2, arg3);
+    return tmp;
+  }
+
+
+  // no arg
+
+  template <>
+  struct args_<> : public abstract::args
+  {
+    args_()
+    {}
+    typedef mlc::none arg1_type;
+    typedef mlc::none arg2_type;
+    typedef mlc::none arg3_type;
+  };
+
+  args_<> mk_args()
+  {
+    args_<> tmp;
+    return tmp;
+  }
+
+
+  // a single arg
+
+  template <typename A1>
+  struct args_< A1 > : public abstract::args
+  {
+    args_(const A1& arg1)
+      : arg1(arg1)
+    {}
+    const A1 arg1;
+    typedef A1 arg1_type;
+    typedef mlc::none arg2_type;
+    typedef mlc::none arg3_type;
+  };
+
+  template <typename A1>
+  args_<A1> mk_args(const A1& arg1)
+  {
+    args_<A1> tmp(arg1);
+    return tmp;
+  }
+
+
+  // a couple of args
+
+  template <typename A1, typename A2>
+  struct args_< A1, A2 > : public abstract::args
+  {
+    args_(const A1& arg1, const A2& arg2)
+      : arg1(arg1),
+	arg2(arg2)
+    {}
+    const A1 arg1;
+    const A2 arg2;
+    typedef A1 arg1_type;
+    typedef A2 arg2_type;
+    typedef mlc::none arg3_type;
+  };
+
+  template <typename A1, typename A2>
+  args_<A1,A2> mk_args(const A1& arg1, const A2& arg2)
+  {
+    args_<A1,A2> tmp(arg1, arg2);
+    return tmp;
+  }
+
+
+} // end of namespace xtd
+
+
+#endif // ! EXTENDED_ARGS_HH
Index: xtd/literal.hh
--- xtd/literal.hh	(revision 0)
+++ xtd/literal.hh	(revision 0)
@@ -0,0 +1,113 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_LITERAL_HH
+# define EXTENDED_LITERAL_HH
+
+# include <xtd/abstract/plain_fun.hh>
+
+
+
+namespace xtd
+{
+
+  /*! \class xtd::literal_<T>
+  **
+  ** FIXME: doc
+  */
+
+  template <typename T> struct literal_; // fwd decl
+
+  template <typename T>
+  struct fun_traits_< literal_<T> >
+  {
+    typedef T res_type;
+  };
+  
+  template <typename T>
+  struct literal_ : public abstract::plain_nary_fun_< 0, literal_<T> >
+  {
+    const T value;
+
+    literal_(const T& value)
+      : value(value)
+    {} 
+
+    T impl_op() const
+    {
+      return this->value;
+    }
+  };
+
+
+
+  // literal as fun expression
+  // FIXME: this should be the only version (?)
+  // FIXME: we should remove the plain version (?)
+
+  template <typename T>
+  struct literal_expr_;
+
+  
+  template <typename T>
+  struct nargs_< literal_expr_<T> >
+  {
+    static const unsigned ret = 0;
+  };
+
+
+  template <typename T, typename Args>
+  struct expr_res_< literal_expr_<T>, Args >
+  {
+    typedef T ret;
+  };
+
+
+  template <typename T>
+  struct literal_expr_
+
+    : public abstract::nary_fun_expr_< 0, literal_expr_<T> >
+  {
+    const T value;
+
+    literal_expr_(const T& value) :
+      value(value)
+    {}
+
+    template <typename Args>
+    T impl_eval(const Args&) const
+    {
+      return this->value;
+    }
+  };
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_LITERAL_HH
Index: xtd/ops_expr.hh
--- xtd/ops_expr.hh	(revision 0)
+++ xtd/ops_expr.hh	(revision 0)
@@ -0,0 +1,84 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_OPS_EXPR_HH
+# define EXTENDED_OPS_EXPR_HH
+
+# include <mlc/case.hh>
+
+# include <xtd/abstract/fun_expr.hh>
+# include <xtd/mexpr.hh>
+# include <xtd/math/arith.hh>
+
+
+namespace xtd
+{
+
+//   namespace abstract
+//   {
+
+
+  // +
+
+    template <typename L, typename R>
+    xtd::m2expr_<xtd::plus_type, L, R>
+    operator + (const xtd::abstract::fun_expr_<L>& lexpr,
+		const xtd::abstract::fun_expr_<R>& rexpr)
+    {
+      xtd::m2expr_<xtd::plus_type, L, R> tmp(lexpr, rexpr);
+      return tmp;
+    }
+
+  // HERE
+
+//     template <typename R>
+//     xtd::m2expr_<xtd::plus_type, m0expr<literal_<int> >, R>
+//     operator + (int i,
+// 		const xtd::abstract::fun_expr_<R>& rexpr)
+//     {
+//       xtd::m2expr<xtd::plus_type, L, R> tmp;
+//       return tmp;
+//     }
+
+
+  // *
+
+    template <typename L, typename R>
+    xtd::m2expr_<xtd::mult_type, L, R>
+    operator * (const xtd::abstract::fun_expr_<L>& lexpr,
+		const xtd::abstract::fun_expr_<R>& rexpr)
+    {
+      xtd::m2expr_<xtd::mult_type, L, R> tmp(lexpr, rexpr);
+      return tmp;
+    }
+
+//   } // end of namespace xtd::abstract
+
+} // end of namespace xtd
+
+
+#endif // ! EXTENDED_OPS_EXPR_HH
Index: xtd/abstract/nary_fun.hh
--- xtd/abstract/nary_fun.hh	(revision 0)
+++ xtd/abstract/nary_fun.hh	(revision 0)
@@ -0,0 +1,53 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_ABSTRACT_NARY_FUN_HH
+# define EXTENDED_ABSTRACT_NARY_FUN_HH
+
+
+namespace xtd
+{
+
+  namespace abstract
+  {
+
+    // FIXME: doc!
+
+    template <unsigned n>
+    class nary_fun_
+    {
+    protected:
+      nary_fun_()
+      {}
+    };
+
+  } // end of namespace xtd::abstract
+
+} // end of namespace xtd
+
+
+#endif // ! EXTENDED_ABSTRACT_NARY_FUN_HH
Index: xtd/abstract/exact.hh
--- xtd/abstract/exact.hh	(revision 0)
+++ xtd/abstract/exact.hh	(revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_ABSTRACT_EXACT_HH
+# define EXTENDED_ABSTRACT_EXACT_HH
+
+
+namespace xtd
+{
+
+  namespace abstract
+  {
+
+    template <typename E> class plain_fun_;
+    template <typename E> class meta_fun_;
+    template <typename E> class fun_expr_;
+
+  } // end of namespace xtd::abstract
+
+
+  // plain_fun_
+
+  template <typename E>
+  const E* exact_of(const abstract::plain_fun_<E>* f)
+  {
+    return (const E*)(const void*)(f);
+  }
+
+  template <typename E>
+  const E& exact_of(const abstract::plain_fun_<E>& f)
+  {
+    return *exact_of(&f);
+  }
+
+
+  // meta_fun_
+
+  template <typename E>
+  const E* exact_of(const abstract::meta_fun_<E>* f)
+  {
+    return (const E*)(const void*)(f);
+  }
+
+  template <typename E>
+  const E& exact_of(const abstract::meta_fun_<E>& f)
+  {
+    return *exact_of(&f);
+  }
+
+
+  // fun_expr_
+
+  template <typename E>
+  const E* exact_of(const abstract::fun_expr_<E>* f)
+  {
+    return (const E*)(const void*)(f);
+  }
+
+  template <typename E>
+  const E& exact_of(const abstract::fun_expr_<E>& f)
+  {
+    return *exact_of(&f);
+  }
+
+
+} // end of namespace xtd
+
+
+#endif // ! EXTENDED_ABSTRACT_EXACT_HH
Index: xtd/abstract/fun_expr.hh
--- xtd/abstract/fun_expr.hh	(revision 0)
+++ xtd/abstract/fun_expr.hh	(revision 0)
@@ -0,0 +1,225 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_ABSTRACT_FUN_EXPR_HH
+# define EXTENDED_ABSTRACT_FUN_EXPR_HH
+
+# include <mlc/bool.hh>
+# include <mlc/is_a.hh>
+# include <mlc/comma.hh>
+
+# include <xtd/args.hh>
+# include <xtd/res.hh>
+# include <xtd/abstract/exact.hh>
+# include <xtd/abstract/meta_fun.hh>
+
+
+
+
+namespace xtd
+{
+
+  namespace ERROR
+  {
+
+    struct INTERNAL_ILL_FORMED_CALL_TO_xtd_fun_expr_eval;
+
+  } // end of namespace xtd::ERROR
+
+
+
+  namespace abstract
+  {
+
+    /*! \class xtd::abstract::fun_expr_<E>
+    **
+    ** Abstract base class for function expressions.  Parameter E is
+    ** the exact type of the function expression.
+    **
+    ** Design note: this class does not derive from xtd::abstract::any
+    ** to avoid diamond inheritance since fun_expr classes are also
+    ** meta_fun classes.
+    */
+
+    template <typename E>
+    class fun_expr_
+
+    // FIXME: at that point, we should verify that nargs_<E> is user-defined...
+
+      : public fun_<E>
+    {
+    public:
+
+      // evaluation:
+
+      template <typename Args>
+      xtd_expr_res(E, Args)
+      eval(const Args& as) const
+      {
+	mlc::assert_< mlc_is_a(Args, xtd::abstract::args),
+                      xtd::ERROR::INTERNAL_ILL_FORMED_CALL_TO_xtd_fun_expr_eval >::check();
+	return exact_of(this)->impl_eval(as);
+      }
+
+      // FIXME: the get_nargs method is obsolete; remove it!
+      unsigned nargs() const { return xtd_nargs(E); }
+
+    protected:
+      fun_expr_() {}
+    };
+
+
+
+    /*! \class xtd::abstract::nary_fun_expr_<n, E>
+    **
+    ** Abstract base class for function expressions with an explicit
+    ** number of arguments.
+    **
+    ** Parameter n is the number of arguments with n being 0, 1, 2, or
+    ** 3.
+    **
+    ** Parameter E is the exact type of the function.
+    */
+
+    template <unsigned n, typename E>
+    class nary_fun_expr_;
+
+
+
+    /*! \class xtd::abstract::nary_fun_expr_<0, E>
+    **
+    ** Abstract base class for function expressions taking no
+    ** argument.
+    **
+    ** Parameter E is the exact type of the function.
+    */
+
+    template <typename E>
+    class nary_fun_expr_< 0, E >
+
+      : public fun_expr_<E>,
+	public meta_nary_fun_<0, E>
+    {
+    public:
+      xtd_res_0(E) impl_calc() const
+      {
+	return this->eval(mk_args());
+      }
+    protected:
+      nary_fun_expr_() {}
+    };
+
+
+
+    /*! \class xtd::abstract::nary_fun_expr_<1, E>
+    **
+    ** Abstract base class for function expressions taking one
+    ** argument.
+    **
+    ** Parameter E is the exact type of the function.
+    */
+
+    template <typename E>
+    class nary_fun_expr_< 1, E >
+
+      : public fun_expr_<E>,
+	public meta_nary_fun_<1, E>
+    {
+    public:
+      template <typename A>
+      xtd_res_1(E, A)
+      impl_calc(const A& a) const
+      {
+	return this->eval(mk_args(a));
+      }
+    protected:
+      nary_fun_expr_() {}
+    };
+
+
+
+    /*! \class xtd::abstract::nary_fun_expr_<2, E>
+    **
+    ** Abstract base class for function expressions taking two
+    ** arguments.
+    **
+    ** Parameter E is the exact type of the function.
+    */
+
+    template <typename E>
+    class nary_fun_expr_< 2, E >
+
+      : public fun_expr_<E>,
+	public meta_nary_fun_<2, E>
+    {
+    public:
+      template <typename A1, typename A2>
+      xtd_res_2(E, A1, A2)
+      impl_calc(const A1& a1, const A2& a2) const
+      {
+	return this->eval(mk_args(a1, a2));
+      }
+    protected:
+      nary_fun_expr_() {}
+    };
+
+
+
+    /*! \class xtd::abstract::nary_fun_expr_<3, E>
+    **
+    ** Abstract base class for function expressions taking three
+    ** arguments.
+    **
+    ** Parameter E is the exact type of the function.
+    */
+
+    template <typename E>
+    class nary_fun_expr_< 3, E >
+
+      : public fun_expr_<E>,
+	public meta_nary_fun_<3, E>
+    {
+    public:
+      template <typename A1, typename A2, typename A3>
+      xtd_res_3(E, A1, A2, A3)
+      impl_calc(const A1& a1, const A2& a2, const A3& a3) const
+      {
+	return this->eval(mk_args(a1, a2, a3));
+      }
+    protected:
+      nary_fun_expr_() {}
+    };
+
+
+  } // end of namespace xtd::abstract
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_ABSTRACT_FUN_EXPR_HH
Index: xtd/abstract/any.hh
--- xtd/abstract/any.hh	(revision 0)
+++ xtd/abstract/any.hh	(revision 0)
@@ -0,0 +1,67 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_ABSTRACT_ANY_HH
+# define EXTENDED_ABSTRACT_ANY_HH
+
+
+
+namespace xtd
+{
+
+  namespace abstract
+  {
+
+    /*! \class xtd::abstract::any
+    **
+    ** Abstract base class for static hierarchies in xtd.  Parameter E
+    ** is the exact type.
+    */
+
+    template <class E>
+    class any
+    {
+    public:
+
+      typedef E exact_type;
+
+      // exact is not provided by stc::any so that xtd is independant
+      // from the stc lib.
+      E& exact() { return *(E*)(void*)(this); }
+      const E& exact() const { return *(const E*)(const void*)(this); }
+
+    protected:
+      any() {}
+    };
+
+
+  } // end of namespace abstract::xtd
+
+} // end of namespace xtd
+ 
+
+#endif // ! EXTENDED_ABSTRACT_ANY_HH
Index: xtd/abstract/fun.hh
--- xtd/abstract/fun.hh	(revision 0)
+++ xtd/abstract/fun.hh	(revision 0)
@@ -0,0 +1,58 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_ABSTRACT_FUN_HH
+# define EXTENDED_ABSTRACT_FUN_HH
+
+
+namespace xtd
+{
+
+  namespace abstract
+  {
+
+    /*! \class xtd::abstract::fun_
+    **
+    ** Abstract base class for xtd functions.  Parameter E is the
+    ** exact type of the function.
+    */
+
+    template <typename E>
+    class fun_
+    {
+    protected:
+      fun_() {}
+    };
+
+
+  } // end of namespace xtd::abstract
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_ABSTRACT_FUN_HH
Index: xtd/abstract/plain_fun.hh
--- xtd/abstract/plain_fun.hh	(revision 0)
+++ xtd/abstract/plain_fun.hh	(revision 0)
@@ -0,0 +1,271 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_ABSTRACT_PLAIN_FUN_HH
+# define EXTENDED_ABSTRACT_PLAIN_FUN_HH
+
+# include <mlc/flags.hh>
+# include <mlc/bool.hh> // FIXME: should be assert.hh
+# include <mlc/is_a.hh>
+# include <mlc/typedef.hh>
+
+# include <xtd/abstract/exact.hh>
+# include <xtd/abstract/fun.hh>
+# include <xtd/abstract/nary_fun.hh>
+
+
+// macros
+
+# define xtd_arg(F)  typename xtd::typedef_::arg_type::from_<xtd::fun_traits_<F> >::ret
+
+# define xtd_arg1(F) typename xtd::typedef_::arg1_type::from_<xtd::fun_traits_<F> >::ret
+# define xtd_arg2(F) typename xtd::typedef_::arg2_type::from_<xtd::fun_traits_<F> >::ret
+# define xtd_arg3(F) typename xtd::typedef_::arg3_type::from_<xtd::fun_traits_<F> >::ret
+
+# define xtd_res(F)  typename xtd::typedef_::res_type::from_<xtd::fun_traits_<F> >::ret
+
+
+
+
+namespace xtd
+{
+
+  namespace ERROR
+  {
+    struct SPECIALIZATION_OF_xtd_fun_traits_NOT_FOUND_FOR_AN_xtd_plain_fun;
+    struct xtd_fun_traits_SHOULD_DEFINE_res_type_FOR_AN_xtd_plain_fun;
+
+    struct xtd_fun_traits_SHOULD_DEFINE_arg_type_FOR_AN_xtd_plain_nary_fun_WITH_n_BEING_1;
+
+    struct xtd_fun_traits_SHOULD_DEFINE_arg1_type_FOR_AN_xtd_plain_nary_fun_WITH_n_BEING_2;
+    struct xtd_fun_traits_SHOULD_DEFINE_arg2_type_FOR_AN_xtd_plain_nary_fun_WITH_n_BEING_2;
+
+    struct xtd_fun_traits_SHOULD_DEFINE_arg1_type_FOR_AN_xtd_plain_nary_fun_WITH_n_BEING_3;
+    struct xtd_fun_traits_SHOULD_DEFINE_arg2_type_FOR_AN_xtd_plain_nary_fun_WITH_n_BEING_3;
+    struct xtd_fun_traits_SHOULD_DEFINE_arg3_type_FOR_AN_xtd_plain_nary_fun_WITH_n_BEING_3;
+
+    struct YOU_SHOULD_NOT_DERIVE_FROM_xtd_plain_fun_BUT_FROM_xtd_plain_nary_fun;
+
+    // FIXME: add error messages corresponding to definitions without sense
+    // FIXME: such as having arg2 when the plain function is unary
+
+  } // end of namespace xtd::ERROR
+
+
+  template <typename F>
+  struct fun_traits_ : public mlc::undefined
+  {
+    // nothing
+  };
+
+  mlc_decl_typedef(arg_type);
+
+  mlc_decl_typedef(arg1_type);
+  mlc_decl_typedef(arg2_type);
+  mlc_decl_typedef(arg3_type);
+
+  mlc_decl_typedef(res_type);
+
+
+  namespace abstract
+  {
+
+    // fwd decl
+    template <unsigned n, typename E> class plain_nary_fun_;
+
+
+
+    /*! \class xtd::abstract::plain_fun_
+    **
+    ** Abstract base class for plain functions.  Parameter E is the
+    ** exact type of the function.
+    */
+
+    template <typename E>
+    class plain_fun_
+
+      : private mlc::assert_< mlc_is_not_a(xtd::fun_traits_<E>, mlc::undefined),
+			      xtd::ERROR::SPECIALIZATION_OF_xtd_fun_traits_NOT_FOUND_FOR_AN_xtd_plain_fun >,
+
+	private mlc::assert_< mlc::neq_<xtd_res(E), mlc::not_found>,
+                              xtd::ERROR::xtd_fun_traits_SHOULD_DEFINE_res_type_FOR_AN_xtd_plain_fun >,
+
+	public fun_<E>
+    {
+    protected:
+      plain_fun_(){
+	// FIXME: unsigned is parameter so mlc_is_a does not work
+// 	mlc::assert_< mlc_is_a(E, plain_nary_fun_),
+// 	              xtd::ERROR::YOU_SHOULD_NOT_DERIVE_FROM_xtd_plain_fun_BUT_FROM_xtd_plain_nary_fun
+// 	  >::check();
+      }
+    };
+
+
+    /*! \class xtd::abstract::plain_nary_fun_<n, E>
+    **
+    ** Abstract base class for plain functions with an explicit number
+    ** of arguments.
+    **
+    ** Parameter n is the number of arguments with n being 0, 1, 2, or
+    ** 3.
+    **
+    ** Parameter E is the exact type of the function.
+    */
+
+    template <unsigned n, typename E>
+    class plain_nary_fun_;
+
+
+
+    /*! \class xtd::abstract::plain_nary_fun_<0, E>
+    **
+    ** Abstract base class for plain functions taking no argument.
+    ** This class is defined as a specialization.
+    **
+    ** Parameter E is the exact type of the function.
+    */
+
+    template <typename E>
+    class plain_nary_fun_< 0, E >
+
+      : public plain_fun_<E>,
+	public nary_fun_<0>
+    {
+    public:
+      xtd_res(E) operator()() const
+      {
+	return exact_of(this)->impl_op();
+      }
+    protected:
+      plain_nary_fun_() {}
+    };
+
+
+
+    /*! \class xtd::abstract::plain_nary_fun_<1, E>
+    **
+    ** Abstract base class for plain functions taking one argument.
+    ** This class is defined as a specialization.
+    **
+    ** Parameter E is the exact type of the function.
+    */
+
+    template <typename E>
+    class plain_nary_fun_< 1, E >
+
+      : public plain_fun_<E>,
+	public nary_fun_<1>,
+
+	private mlc::assert_< mlc::neq_<xtd_arg(E), mlc::not_found>,
+                              xtd::ERROR::xtd_fun_traits_SHOULD_DEFINE_arg_type_FOR_AN_xtd_plain_nary_fun_WITH_n_BEING_1 >
+    {
+    public:
+      xtd_res(E) operator()(const xtd_arg(E)& arg) const
+      {
+	return exact_of(this)->impl_op(arg);
+      }
+    protected:
+      plain_nary_fun_() {}
+    };
+
+
+
+    /*! \class xtd::abstract::plain_nary_fun_<2, E>
+    **
+    ** Abstract base class for plain functions taking two arguments.
+    ** This class is defined as a specialization.
+    **
+    ** Parameter E is the exact type of the function.
+    */
+
+    template <typename E>
+    class plain_nary_fun_< 2, E >
+
+      : public plain_fun_<E>,
+	public nary_fun_<2>,
+
+	private mlc::assert_< mlc::neq_<xtd_arg1(E), mlc::not_found>,
+                              xtd::ERROR::xtd_fun_traits_SHOULD_DEFINE_arg1_type_FOR_AN_xtd_plain_nary_fun_WITH_n_BEING_2 >,
+
+	private mlc::assert_< mlc::neq_<xtd_arg2(E), mlc::not_found>,
+                              xtd::ERROR::xtd_fun_traits_SHOULD_DEFINE_arg2_type_FOR_AN_xtd_plain_nary_fun_WITH_n_BEING_2 >
+    {
+    public:
+      xtd_res(E) operator()(const xtd_arg1(E)& arg1,
+			    const xtd_arg2(E)& arg2) const
+      {
+	return exact_of(this)->impl_op(arg1, arg2);
+      }
+    protected:
+      plain_nary_fun_() {}
+    };
+
+
+
+    /*! \class xtd::abstract::plain_nary_fun_<3, E>
+    **
+    ** Abstract base class for plain functions taking three arguments.
+    ** This class is defined as a specialization.
+    **
+    ** Parameter E is the exact type of the function.
+    */
+
+    template <typename E>
+    class plain_nary_fun_< 3, E >
+
+      : public plain_fun_<E>,
+	public nary_fun_<3>,
+
+	private mlc::assert_< mlc::neq_<xtd_arg1(E), mlc::not_found>,
+                              xtd::ERROR::xtd_fun_traits_SHOULD_DEFINE_arg1_type_FOR_AN_xtd_plain_nary_fun_WITH_n_BEING_3 >,
+
+	private mlc::assert_< mlc::neq_<xtd_arg2(E), mlc::not_found>,
+                              xtd::ERROR::xtd_fun_traits_SHOULD_DEFINE_arg2_type_FOR_AN_xtd_plain_nary_fun_WITH_n_BEING_3 >,
+
+	private mlc::assert_< mlc::neq_<xtd_arg3(E), mlc::not_found>,
+                              xtd::ERROR::xtd_fun_traits_SHOULD_DEFINE_arg3_type_FOR_AN_xtd_plain_nary_fun_WITH_n_BEING_3 >
+    {
+    public:
+      xtd_res(E) operator()(const xtd_arg1(E)& arg1,
+			    const xtd_arg2(E)& arg2,
+			    const xtd_arg3(E)& arg3) const
+      {
+	return exact_of(this)->impl_op(arg1, arg2, arg3);
+      }
+    protected:
+      plain_nary_fun_() {}
+    };
+
+
+  } // end of namespace xtd::abstract
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_ABSTRACT_PLAIN_FUN_HH
Index: xtd/abstract/meta_fun.hh
--- xtd/abstract/meta_fun.hh	(revision 0)
+++ xtd/abstract/meta_fun.hh	(revision 0)
@@ -0,0 +1,290 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_ABSTRACT_META_FUN_HH
+# define EXTENDED_ABSTRACT_META_FUN_HH
+
+# include <mlc/pair.hh>
+# include <mlc/valist.hh>
+
+# include <xtd/abstract/exact.hh>
+# include <xtd/abstract/fun.hh>
+# include <xtd/abstract/nary_fun.hh>
+# include <xtd/args.hh>
+# include <xtd/res.hh>
+# include <xtd/case.hh>
+
+
+
+
+// macros
+
+namespace xtd
+{
+
+  // FIXME: document case stuff...
+
+  namespace tag
+  {
+
+    struct meta_1ary_fun_operator;
+    struct meta_2ary_fun_operator;
+    struct meta_3ary_fun_operator;
+
+  } // end of namespace xtd::tag
+
+
+  // meta_nary_fun_<1, E>::operator()(const A& a) const
+
+  template <typename E, typename A>
+  struct default_case_ < tag::meta_1ary_fun_operator,
+			 mlc::pair_<E, A> >
+  {
+    typedef xtd_res_1(E, A) res;
+
+    static res impl(const abstract::meta_nary_fun_<1, E>* this_,
+		    const A& a)
+    {
+      return exact_of(this_)->impl_calc(a);
+    }
+  };
+
+
+  // meta_nary_fun_<2, E>::operator()(const A1& a1, const A2& a2) const
+
+  template <typename E, typename A1, typename A2>
+  struct default_case_ < tag::meta_2ary_fun_operator,
+			 mlc::valist_<E, A1, A2> >
+  {
+    typedef xtd_res_2(E, A1, A2) res;
+
+    static res impl(const abstract::meta_nary_fun_<2, E>* this_,
+		    const A1& a1, const A2& a2)
+    {
+      return exact_of(this_)->impl_calc(a1, a2);
+    }
+  };
+
+
+  // meta_nary_fun_<3, E>::operator()(const A1& a1, const A2& a2, const A3& a3) const
+
+  template <typename E, typename A1, typename A2, typename A3>
+  struct default_case_ < tag::meta_3ary_fun_operator,
+			 mlc::valist_<E, A1, A2, A3> >
+  {
+    typedef xtd_res_3(E, A1, A2, A3) res;
+
+    static res impl(const abstract::meta_nary_fun_<3, E>* this_,
+		    const A1& a1, const A2& a2, const A3& a3)
+    {
+      return exact_of(this_)->impl_calc(a1, a2, a3);
+    }
+  };
+
+
+} // end of namespace xtd
+
+
+namespace xtd
+{
+
+  namespace abstract
+  {
+
+
+    /*! \class xtd::abstract::meta_fun_<E>
+    **
+    ** Abstract base class for meta functions.  Parameter E is the
+    ** exact type of the function.
+    */
+
+    template <typename E>
+    class meta_fun_
+
+      : public fun_<E>
+    {
+    protected:
+      meta_fun_()
+      {
+	// FIXME: mlc_is_a does not work with unsigned parameter...
+// 	mlc::assert_< mlc_is_a(E, xtd::abstract::meta_nary_fun_),
+// 	              xtd::ERROR::YOU_SHOULD_NOT_DERIVE_DIRECTLY_FROM_xtd_meta_fun_BUT_FROM_xtd_meta_nary_fun_
+// 	            >::check();
+      }
+    };
+
+
+    /*! \class xtd::abstract::meta_nary_fun_<n, E>
+    **
+    ** Abstract base class for meta functions with an explicit number
+    ** of arguments.
+    **
+    ** Parameter n is the number of arguments with n being 1, 2, or 3.
+    **
+    ** Parameter E is the exact type of the function.
+    */
+
+    template <unsigned n, typename E>
+    class meta_nary_fun_;
+
+
+
+    /*! \class xtd::abstract::meta_nary_fun_<0, E>
+    **
+    ** Abstract base class for meta functions taking no argument.
+    ** This class is defined as a specialization.
+    **
+    ** Parameter E is the exact type of the function.
+    */
+
+    template <typename E>
+    class meta_nary_fun_< 0, E >
+
+      : public meta_fun_<E>,
+	public nary_fun_<0>
+    {
+    public:
+
+      xtd_res_0(E)
+      operator()() const
+      {
+	return exact_of(this)->impl_calc();
+      }
+
+    protected:
+      meta_nary_fun_() {}
+    };
+
+
+
+    /*! \class xtd::abstract::meta_nary_fun_<1, E>
+    **
+    ** Abstract base class for meta functions taking one argument.
+    ** This class is defined as a specialization.
+    **
+    ** Parameter E is the exact type of the function.
+    */
+
+    template <typename E>
+    class meta_nary_fun_< 1, E >
+
+      : public meta_fun_<E>,
+	public nary_fun_<1>
+    {
+    public:
+
+      template <typename A>
+      struct case_ : public xtd::case_< xtd::tag::meta_1ary_fun_operator,
+					mlc::pair_<E, A> >::ret
+      {};
+
+      template <typename A>
+      typename case_<A>::res
+      operator()(const A& a) const
+      {
+	return case_<A>::impl(this, a);
+      }
+
+    protected:
+      meta_nary_fun_() {}
+    };
+
+
+
+    /*! \class xtd::abstract::meta_nary_fun_<2, E>
+    **
+    ** Abstract base class for meta functions taking two arguments.
+    ** This class is defined as a specialization.
+    **
+    ** Parameter E is the exact type of the function.
+    */
+
+    template <typename E>
+    class meta_nary_fun_< 2, E >
+
+      : public meta_fun_<E>,
+	public nary_fun_<2>
+    {
+    public:
+
+      template <typename A1, typename A2>
+      struct case_ : public xtd::case_< xtd::tag::meta_2ary_fun_operator,
+					mlc::valist_<E, A1, A2> >::ret
+      {};
+
+      template <typename A1, typename A2>
+      typename case_<A1, A2>::res
+      operator()(const A1& a1, const A2& a2) const
+      {
+	return case_<A1, A2>::impl(this, a1, a2);
+      }
+
+    protected:
+      meta_nary_fun_() {}
+    };
+
+
+    /*! \class xtd::abstract::meta_nary_fun_<3, E>
+    **
+    ** Abstract base class for meta functions taking three arguments.
+    ** This class is defined as a specialization.
+    **
+    ** Parameter E is the exact type of the function.
+    */
+
+    template <typename E>
+    class meta_nary_fun_< 3, E >
+
+      : public meta_fun_<E>,
+	public nary_fun_<3>
+    {
+    public:
+
+      template <typename A1, typename A2, typename A3>
+      struct case_ : public xtd::case_< xtd::tag::meta_3ary_fun_operator,
+					mlc::valist_<E, A1, A2, A3> >::ret
+      {};
+
+      template <typename A1, typename A2, typename A3>
+      typename case_<A1, A2, A3>::res
+      operator()(const A1& a1, const A2& a2, const A3& a3) const
+      {
+	return case_<A1, A2, A3>::impl(this, a1, a2, a3);
+      }
+
+    protected:
+      meta_nary_fun_() {}
+    };
+
+
+  } // end of namespace xtd::abstract
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_ABSTRACT_META_FUN_HH
Index: xtd/mfun.hh
--- xtd/mfun.hh	(revision 0)
+++ xtd/mfun.hh	(revision 0)
@@ -0,0 +1,195 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_MFUN_HH
+# define EXTENDED_MFUN_HH
+
+# include <mlc/assert.hh>
+# include <mlc/logic.hh>
+# include <mlc/is_a.hh>
+
+# include <xtd/abstract/plain_fun.hh>
+# include <xtd/abstract/meta_fun.hh>
+
+
+
+// FIXME: in this file replace impl_calc by impl_op
+
+
+namespace xtd
+{
+
+
+  namespace ERROR
+  {
+
+    struct AN_xtd_m1fun_SHOULD_TAKE_AS_PARAMETER_AN_xtd_plain_nary_fun_WITH_n_BEING_1;
+    struct AN_xtd_m2fun_SHOULD_TAKE_AS_PARAMETER_AN_xtd_plain_nary_fun_WITH_n_BEING_2;
+    struct AN_xtd_m3fun_SHOULD_TAKE_AS_PARAMETER_AN_xtd_plain_nary_fun_WITH_n_BEING_3;
+
+  } // end of namespace xtd::ERROR
+
+
+
+
+  // equipment for xtd::m1fun_<F>
+
+  template <template <typename> class F>
+  struct m1fun_;
+
+  template <template <typename> class F, typename A>
+  struct res_< m1fun_<F>, A >
+
+    : private mlc::assert_< mlc::and_< mlc_is_a(F<A>, abstract::plain_fun_),
+				       mlc_is_a(F<A>, abstract::nary_fun_<1>) >,
+			    xtd::ERROR::AN_xtd_m1fun_SHOULD_TAKE_AS_PARAMETER_AN_xtd_plain_nary_fun_WITH_n_BEING_1 >
+
+  {
+    typedef xtd_res(F<A>) ret;
+  };
+
+
+  /*! \class xtd::m1fun_<F>
+  **
+  ** FIXME: doc
+  */
+
+  template <template <typename> class F>
+  struct m1fun_ : public abstract::meta_nary_fun_< 1, m1fun_<F> >
+  {
+    template <typename A>
+    xtd_res(F<A>) impl_calc(const A& a) const
+      //          ---------
+    {
+      typedef F<A> F_;
+      mlc::assert_< mlc::and_< mlc_is_a(F_, abstract::plain_fun_),
+			       mlc_is_a(F_, abstract::nary_fun_<1>) >,
+	            xtd::ERROR::AN_xtd_m1fun_SHOULD_TAKE_AS_PARAMETER_AN_xtd_plain_nary_fun_WITH_n_BEING_1
+	>::check();
+      static const F_ f_;
+      return f_(a);
+    }
+  };
+
+
+
+
+
+  // equipment for xtd::m2fun_<F>
+
+  template <template <typename, typename> class F>
+  struct m2fun_;
+
+
+  template <template <typename, typename> class F,
+	    typename A1, typename A2>
+
+  struct res_< m2fun_<F>, A1, A2 >
+
+    : private mlc::assert_< mlc::and_< mlc_is_a(mlc_comma_1(F<A1,A2>), abstract::plain_fun_),
+				       mlc_is_a(mlc_comma_1(F<A1,A2>), abstract::nary_fun_<2>) >,
+			    xtd::ERROR::AN_xtd_m2fun_SHOULD_TAKE_AS_PARAMETER_AN_xtd_plain_nary_fun_WITH_n_BEING_2 >
+  {
+    typedef F<A1,A2> F_;
+    typedef xtd_res(F_) ret;
+  };
+
+
+  /*! \class xtd::m2fun_<F>
+  **
+  ** FIXME: doc
+  */
+
+  template <template <typename, typename> class F>
+  struct m2fun_ : public abstract::meta_nary_fun_< 2, m2fun_<F> >
+  {
+    template <typename A1, typename A2>
+    xtd_res(mlc_comma_1(F<A1,A2>)) impl_calc(const A1& a1, const A2& a2) const
+      //                           ---------
+    {
+      typedef F<A1,A2> F_;
+      mlc::assert_< mlc::and_< mlc_is_a(F_, abstract::plain_fun_),
+			       mlc_is_a(F_, abstract::nary_fun_<2>) >,
+	            xtd::ERROR::AN_xtd_m2fun_SHOULD_TAKE_AS_PARAMETER_AN_xtd_plain_nary_fun_WITH_n_BEING_2 >::check();
+      static const F_ f_;
+      return f_(a1, a2);
+    }
+  };
+
+
+
+
+
+
+  // equipment for xtd::m3fun_<F>
+
+  template <template <typename, typename, typename> class F>
+  struct m3fun_;
+
+
+  template <template <typename, typename, typename> class F,
+	    typename A1, typename A2, typename A3>
+
+  struct res_< m3fun_<F>, A1, A2, A3 >
+
+    : private mlc::assert_< mlc::and_< mlc_is_a(mlc_comma_2(F<A1,A2,A3>), abstract::plain_fun_),
+				       mlc_is_a(mlc_comma_2(F<A1,A2,A3>), abstract::nary_fun_<3>) >,
+			    xtd::ERROR::AN_xtd_m3fun_SHOULD_TAKE_AS_PARAMETER_AN_xtd_plain_nary_fun_WITH_n_BEING_3 >
+  {
+    typedef F<A1,A2,A3> F_;
+    typedef xtd_res(F_) ret;
+  };
+
+
+  /*! \class xtd::m3fun_<F>
+  **
+  ** FIXME: doc
+  */
+
+  template <template <typename, typename, typename> class F>
+  struct m3fun_ : public abstract::meta_nary_fun_< 3, m3fun_<F> >
+  {
+    template <typename A1, typename A2, typename A3>
+    xtd_res(mlc_comma_2(F<A1,A2,A3>)) impl_calc(const A1& a1, const A2& a2, const A3& a3) const
+      //                              ---------
+    {
+      typedef F<A1,A2,A3> F_;
+      mlc::assert_< mlc::and_< mlc_is_a(F_, abstract::plain_fun_),
+			       mlc_is_a(F_, abstract::nary_fun_<3>) >,
+	            xtd::ERROR::AN_xtd_m3fun_SHOULD_TAKE_AS_PARAMETER_AN_xtd_plain_nary_fun_WITH_n_BEING_3 >::check();
+      static const F_ f_;
+      return f_(a1, a2, a3);
+    }
+  };
+
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MFUN_HH
Index: xtd/traits.hh
--- xtd/traits.hh	(revision 0)
+++ xtd/traits.hh	(revision 0)
@@ -0,0 +1,55 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_TRAITS_HH
+# define EXTENDED_TRAITS_HH
+
+# include <mlc/flags.hh>
+
+
+# define xtd_plus(L, R) typename xtd::plus_trait_< L, R >::ret 
+# define xtd_mult(L, R) typename xtd::mult_trait_< L, R >::ret 
+
+
+namespace xtd
+{
+
+  template <typename L, typename R>
+  struct plus_trait_ : public mlc::undefined
+  {
+  };
+
+  template <typename L, typename R>
+  struct mult_trait_ : public mlc::undefined
+  {
+  };
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_TRAITS_HH
Index: xtd/builtin/traits.hh
--- xtd/builtin/traits.hh	(revision 0)
+++ xtd/builtin/traits.hh	(revision 0)
@@ -0,0 +1,90 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_BUILTIN_TRAITS_HH
+# define EXTENDED_BUILTIN_TRAITS_HH
+
+# include <xtd/traits.hh>
+
+
+namespace xtd
+{
+
+  // FIXME: this is dummy and incomplete code!
+
+
+  // plus
+
+  template <typename T>
+  struct plus_trait_ < T, T >
+  {
+    typedef T ret;
+  };
+
+  template <> struct plus_trait_ < float, int > { typedef float ret; };
+  template <> struct plus_trait_ < int, float > { typedef float ret; };
+  template <> struct plus_trait_ < double, int > { typedef double ret; };
+  template <> struct plus_trait_ < int, double > { typedef double ret; };
+  template <> struct plus_trait_ < double, float > { typedef double ret; };
+  template <> struct plus_trait_ < float, double > { typedef double ret; };
+
+  template <> struct plus_trait_ < long double, int > { typedef long double ret; };
+  template <> struct plus_trait_ < int, long double > { typedef long double ret; };
+  template <> struct plus_trait_ < long double, float > { typedef long double ret; };
+  template <> struct plus_trait_ < float, long double > { typedef long double ret; };
+  template <> struct plus_trait_ < long double, double > { typedef long double ret; };
+  template <> struct plus_trait_ < double, long double > { typedef long double ret; };
+
+
+  // mult
+
+  template <typename T>
+  struct mult_trait_ < T, T >
+  {
+    typedef T ret;
+  };
+
+  template <> struct mult_trait_ < float, int > { typedef float ret; };
+  template <> struct mult_trait_ < int, float > { typedef float ret; };
+  template <> struct mult_trait_ < double, int > { typedef double ret; };
+  template <> struct mult_trait_ < int, double > { typedef double ret; };
+  template <> struct mult_trait_ < double, float > { typedef double ret; };
+  template <> struct mult_trait_ < float, double > { typedef double ret; };
+
+  template <> struct mult_trait_ < long double, int > { typedef long double ret; };
+  template <> struct mult_trait_ < int, long double > { typedef long double ret; };
+  template <> struct mult_trait_ < long double, float > { typedef long double ret; };
+  template <> struct mult_trait_ < float, long double > { typedef long double ret; };
+  template <> struct mult_trait_ < long double, double > { typedef long double ret; };
+  template <> struct mult_trait_ < double, long double > { typedef long double ret; };
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_BUILTIN_TRAITS_HH
Index: xtd/arg.hh
--- xtd/arg.hh	(revision 0)
+++ xtd/arg.hh	(revision 0)
@@ -0,0 +1,152 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_ARG_HH
+# define EXTENDED_ARG_HH
+
+# include <mlc/assert.hh>
+# include <mlc/is_a.hh>
+
+# include <xtd/args.hh>
+# include <xtd/mexpr.hh>
+
+
+
+
+# define xtd_nargs(F) xtd::nargs_<F>::ret
+
+
+
+namespace xtd
+{
+
+
+
+  namespace internal
+  {
+
+    // FIXME: doc
+
+    template <unsigned i> struct impl_arg_;
+
+    template <>
+    struct impl_arg_<1>
+    {
+      template <typename Args>
+      typename Args::arg1_type impl_eval(const Args& args) const
+      {
+	mlc::assert_< mlc_is_a(Args, xtd::abstract::args) >::check();
+	return args.arg1;
+      }
+    };
+
+    template <>
+    struct impl_arg_<2>
+    {
+      template <typename Args>
+      typename Args::arg2_type impl_eval(const Args& args) const
+      {
+	mlc::assert_< mlc_is_a(Args, xtd::abstract::args) >::check();
+	return args.arg2;
+      }
+    };
+
+    template <>
+    struct impl_arg_<3>
+    {
+      template <typename Args>
+      typename Args::arg3_type impl_eval(const Args& args) const
+      {
+	mlc::assert_< mlc_is_a(Args, xtd::abstract::args) >::check();
+	return args.arg3;
+      }
+    };
+
+  } // end of namespace xtd::internal
+
+
+
+
+  /*! \class xtd::arg_<i>
+  **
+  ** FIXME: placeholder for the ith argument
+  */
+
+
+  template <unsigned i> struct arg_;
+
+  template <unsigned i>
+  struct nargs_< arg_<i> >
+  {
+    static const unsigned ret = i;
+  };
+
+  
+  template <typename Args>
+  struct expr_res_< arg_<1>, Args >
+  {
+    typedef typename Args::arg1_type ret;
+  };
+  
+  template <typename Args>
+  struct expr_res_< arg_<2>, Args >
+  {
+    typedef typename Args::arg2_type ret;
+  };
+  
+  template <typename Args>
+  struct expr_res_< arg_<3>, Args >
+  {
+    typedef typename Args::arg3_type ret;
+  };
+  
+
+  template <unsigned i>
+  struct arg_
+
+    : public abstract::nary_fun_expr_< i, arg_<i> >,
+
+      public internal::impl_arg_<i>
+
+  // FIXME: add something like ": private mlc::assert_< (i > 1 and i <= 3) >"
+  {
+    typedef internal::impl_arg_<i> super;
+    using super::impl_eval;
+  };
+
+
+  // placeholders:
+
+  const arg_<1> _1 = arg_<1>();
+  const arg_<2> _2 = arg_<2>();
+  const arg_<3> _3 = arg_<3>();
+
+
+} // end of namespace xtd
+
+
+#endif // ! EXTENDED_ARG_HH
Index: xtd/case.hh
--- xtd/case.hh	(revision 0)
+++ xtd/case.hh	(revision 0)
@@ -0,0 +1,37 @@
+// Copyright (C) 2002, 2005, 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef EXTENDED_CASE_HH
+# define EXTENDED_CASE_HH
+
+# include <mlc/case.hh>
+
+
+mlc_case_equipment_for_namespace(xtd);
+
+
+#endif // ! EXTENDED_CASE_HH
Index: tests/id.cc
--- tests/id.cc	(revision 0)
+++ tests/id.cc	(revision 0)
@@ -0,0 +1,43 @@
+#include <iostream>
+
+
+#include <xtd/math/id.hh>
+
+
+
+// namespace xtd 
+// {
+//   struct xfail;
+
+//   template <>
+//   struct fun_traits_< xfail >
+//   {
+//     typedef int res_type;
+//   };
+//   struct xfail : public xtd::abstract::plain_fun_< xfail >
+//   {
+//   };
+  
+// }
+
+
+
+int main()
+{
+
+//   {
+//     xtd::xfail test;
+//   }
+
+
+  {
+    xtd::plain_id_<int> id_int;
+    std::cout << id_int(51) << std::endl;
+
+    xtd::plain_id_<float> id_float;
+    std::cout << id_float(5.1f) << std::endl;
+
+  }
+
+    
+}
Index: tests/cos.cc
--- tests/cos.cc	(revision 0)
+++ tests/cos.cc	(revision 0)
@@ -0,0 +1,52 @@
+#include <iostream>
+
+#include <xtd/math.hh>
+
+
+int main()
+{
+
+//   {
+//     using xtd::cos;
+//     std::cout << cos(5.1f) << std::endl;
+//   }
+
+//   {
+//     using xtd::cos;
+//     using xtd::sin;
+//     using xtd::_1;
+//     using xtd::_2;
+
+//     std::cout << cos(_1)(5.1f) << std::endl;
+//     std::cout << (cos(_1) + sin(_2))(5.f, 1.f) << std::endl;
+//     std::cout << (cos(_1) + sin(_2)).nargs() << std::endl;
+//   }
+
+//   {
+//     using xtd::cos;
+//     using xtd::_1;
+//     using xtd::_2;
+//     std::cout << (cos(_1)(_2)).nargs() << std::endl; // gives: 2
+//   }
+
+  {
+    using xtd::cos;
+    using xtd::sin;
+    using xtd::_1;
+    using xtd::_2;
+
+//     std::cout << (cos(_1) * cos(_1) + sin(_2) * sin(_2))(5.f, 5.f) << std::endl;
+
+//     std::cout << (_1)(_1)(51.f) << std::endl;
+//     std::cout << (_1 + _1)(51.f) << std::endl;
+//     std::cout << (_1 + _2)(5.f, 1.f) << std::endl;
+
+//     (cos(_1) + sin(_1))(_1);
+//     std::cout << (cos(_1) * cos(_1) + sin(_1) * sin(_1))(_1)(51.f) << std::endl;
+
+    std::cout << (_1 * _1 + _2 * _2)(cos(_1), sin(_1))(51.f) << std::endl;
+
+//     std::cout << ((cos(_1) + sin(_2))(_1, _1)).nargs() << std::endl;
+  }
+
+}
Index: tests/Makefile.am
--- tests/Makefile.am	(revision 433)
+++ tests/Makefile.am	(working copy)
@@ -1,8 +1,19 @@
 ## Process this file through Automake to create Makefile.in -*- Makefile -*-
 
-AM_CPPFLAGS = -I$(top_srcdir)/extended -I$(top_srcdir)/metalic
+AM_CPPFLAGS = -I$(top_srcdir)/extended
 # FIXME: Add 
 #
 #   AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_OPTIMIZE) -ggdb
 #
 # when oln.m4 is available in the distribution.
+
+check_PROGRAMS =				\
+  id						\
+  cast						\
+  cos
+
+id_SOURCES = id.cc
+cast_SOURCES = cast.cc
+cos_SOURCES = cos.cc
+
+TESTS = $(check_PROGRAMS)
Index: tests/cast.cc
--- tests/cast.cc	(revision 0)
+++ tests/cast.cc	(revision 0)
@@ -0,0 +1,37 @@
+#include <iostream>
+#include <xtd/cast.hh>
+#include <xtd/arg.hh>
+#include <xtd/math/trigo.hh>
+
+
+int main()
+{
+
+  {
+    xtd::plain_cast_<int, float> fun;
+    std::cout << fun(3.14) << std::endl;
+  }
+
+  {
+    xtd::meta_cast_<int> fun;
+    std::cout << fun(3.14) << std::endl;
+  }
+
+  {
+    using xtd::cast_;
+    using xtd::cos;
+    using xtd::_1;
+    std::cout << (cast_<int>(cos(_1)))(3.14) << std::endl;
+    std::cout << cos(cast_<float>(_1))(3) << std::endl;
+  }
+
+//   {
+//     xtd::cos_<int> c;
+//   }
+
+//   {
+//     using xtd::cos;
+//     cos(1);
+//   }
+
+}
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                    
                        
https://svn.lrde.epita.fr/svn/oln/trunk/metalic
Index: ChangeLog
from  Thierry Geraud  <theo(a)lrde.epita.fr>
	Tiny fix.
	* mlc/logic.hh: Fix missing include.
 logic.hh |    1 +
 1 files changed, 1 insertion(+)
Index: mlc/logic.hh
--- mlc/logic.hh	(revision 432)
+++ mlc/logic.hh	(working copy)
@@ -28,6 +28,7 @@
 #ifndef METALIC_LOGIC_HH
 # define METALIC_LOGIC_HH
 
+# include <mlc/bool.hh>
 # include <mlc/bexpr.hh>
 # include <mlc/assert.hh>
 
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                    
                        
https://svn.lrde.epita.fr/svn/oln/trunk/metalic
Index: ChangeLog
from  Thierry Geraud  <theo(a)lrde.epita.fr>
	Re-enable or_list_ and and_list_.
	* tests/or.cc: New file.
	* tests/Makefile.am: Update.
	* mlc/logic.hh (or_list_, and_list_): Uncomment, update, and bug fix.
	* mlc/assert.hh: Fix missing include.
 mlc/assert.hh     |    4 
 mlc/logic.hh      |  388 +++++++++++++++++++++++++++---------------------------
 tests/Makefile.am |    2 
 tests/or.cc       |   23 +++
 4 files changed, 223 insertions(+), 194 deletions(-)
Index: tests/or.cc
--- tests/or.cc	(revision 0)
+++ tests/or.cc	(revision 0)
@@ -0,0 +1,23 @@
+#include <mlc/cmp.hh>
+#include <mlc/logic.hh>
+#include <mlc/assert.hh>
+
+struct alpha;
+struct beta;
+struct gamma;
+struct delta;
+
+int
+main()
+{
+  typedef beta x;
+
+  mlc::assert_< mlc::or_< mlc_eq(x, alpha),
+                          mlc_eq(x, beta) >
+              >::check();
+
+  mlc::assert_< mlc::or_list_< mlc_eq(x, alpha),
+                               mlc_eq(x, beta),
+                               mlc_eq(x, gamma) >
+              >::check();
+}
Index: tests/Makefile.am
--- tests/Makefile.am	(revision 431)
+++ tests/Makefile.am	(working copy)
@@ -11,6 +11,7 @@
   case						\
   if						\
   is_a						\
+  or						\
   ret						\
   switch					\
   typedef
@@ -18,6 +19,7 @@
 case_SOURCES = case.cc
 if_SOURCES = if.cc
 is_a_SOURCES = is_a.cc
+or_SOURCES = or.cc
 ret_SOURCES = ret.cc
 switch_SOURCES = switch.cc
 typedef_SOURCES = typedef.cc
Index: mlc/logic.hh
--- mlc/logic.hh	(revision 431)
+++ mlc/logic.hh	(working copy)
@@ -121,200 +121,202 @@
   {};
   
 
-//   /// Internal helpers for logical operators between several Boolean types
 
-//   namespace internal
-//   {
-//     // FIXME: doc
-
-//     template <typename A>
-//     struct is_bexpr_or_none_ : public true_ // FIXME: pb using mlc_is_a because of circular deps
-//     {
-//     };
-
-
-//     // va_eval_
-
-//     template <typename A>
-//     struct va_eval_
-//     {
-//       typedef typename A::eval ret;
-//     };
-
-//     template <>
-//     struct va_eval_ <none>
-//     {
-//       typedef none ret;
-//     };
-
-
-//     // or_list_2_
-
-//     template <typename A1, typename A2>
-//     struct or_list_2_
-//       : public or_<A1, A2>::eval
-//     {};
-
-//     template <>
-//     struct or_list_2_ <none, none>
-//       : public true_
-//     {};
-
-//     template <typename A1>
-//     struct or_list_2_ <A1, none>
-//       : public A1
-//     {};
-
-//     template <typename A2>
-//     struct or_list_2_ <none, A2>; // forbidden
-
-//     // or_list_4_
-
-//     template <typename A1, typename A2, typename A3, typename A4>
-//     struct or_list_4_
-//       : public or_list_2_< typename or_list_2_<A1, A2>::eval,
-// 			   typename or_list_2_<A3, A4>::eval >::eval
-//     {};
-
-//     template <>
-//     struct or_list_4_ <none, none, none, none>
-//       : public true_
-//     {};
-
-//     // or_list_
-
-//     template <typename A1, typename A2, typename A3, typename A4,
-// 	      typename A5, typename A6, typename A7, typename A8>
-//     struct or_list_
-//       : public or_list_2_< typename or_list_4_<A1, A2, A3, A4>::eval,
-// 			   typename or_list_4_<A5, A6, A7, A8>::eval >::eval
-//     {};
-
-
-//     // and_list_2_
-
-//     template <typename A1, typename A2>
-//     struct and_list_2_
-//       : public and_<A1, A2>::eval
-//     {};
-
-//     template <>
-//     struct and_list_2_ <none, none>
-//       : public true_
-//     {};
-
-//     template <typename A1>
-//     struct and_list_2_ <A1, none>
-//       : public A1
-//     {};
-
-//     template <typename A2>
-//     struct and_list_2_ <none, A2>; // forbidden
-
-//     // and_list_4_
-
-//     template <typename A1, typename A2, typename A3, typename A4>
-//     struct and_list_4_
-//       : public and_list_2_< typename and_list_2_<A1, A2>::eval,
-// 			    typename and_list_2_<A3, A4>::eval >::eval
-//     {};
-
-//     template <>
-//     struct and_list_4_ <none, none, none, none>
-//       : public true_
-//     {};
-
-//     // and_list_
-
-//     template <typename A1, typename A2, typename A3, typename A4,
-// 	      typename A5, typename A6, typename A7, typename A8>
-//     struct and_list_
-//       : public and_list_2_< typename and_list_4_<A1, A2, A3, A4>::eval,
-// 			    typename and_list_4_<A5, A6, A7, A8>::eval >::eval
-//     {};
-
-//   } // end of mlc::internal
-
-
-
-//   /*! \class mlc::or_list_<..>
-//   **
-//   ** Logical n-ary 'or' operator on a set of Boolean expression types.
-//   ** The number of arguments (parameters) should be at least 3 and at
-//   ** most 8.  This class is also a Boolean expression type.
-//   **
-//   ** Sample use:
-//   ** mlc::or_list_< mlc::eq_<T, int>,
-//   **                mlc_is_a(T, mlc::int_),
-//   **                mlc_is_a(T, my::integer) >
-//   **
-//   ** \see mlc::or_<L,R> mlc::and_list_<..>
-//   */
-
-//   template <typename A1,
-// 	    typename A2,
-// 	    typename A3,
-// 	    typename A4 = none,
-// 	    typename A5 = none,
-// 	    typename A6 = none,
-// 	    typename A7 = none,
-// 	    typename A8 = none>
-//   struct or_list_ : private multiple_assert_< internal::is_bexpr_or_none_<A1>,
-// 					  internal::is_bexpr_or_none_<A2>,
-// 					  internal::is_bexpr_or_none_<A3>,
-// 					  internal::is_bexpr_or_none_<A4>,
-// 					  internal::is_bexpr_or_none_<A5>,
-// 					  internal::is_bexpr_or_none_<A6>,
-// 					  internal::is_bexpr_or_none_<A7>,
-// 					  internal::is_bexpr_or_none_<A8> >,
-// 		    public internal::or_list_< typename internal::va_eval_<A1>::ret,
-// 					       typename internal::va_eval_<A2>::ret,
-// 					       typename internal::va_eval_<A3>::ret,
-// 					       typename internal::va_eval_<A4>::ret,
-// 					       typename internal::va_eval_<A5>::ret,
-// 					       typename internal::va_eval_<A6>::ret,
-// 					       typename internal::va_eval_<A7>::ret,
-// 					       typename internal::va_eval_<A8>::ret >
-//   {
-//   };
-
-
-
-//   /*! \class mlc::and_list_<..>
-//   **
-//   ** Logical n-ary 'and' operator on a set of Boolean expression types.
-//   ** The number of arguments (parameters) should be at least 3 and at
-//   ** most 8.  This class is also a Boolean expression type.
-//   **
-//   ** \see mlc::and_<L,R> mlc::or_list_<..>
-//   */
-
-//   template <typename A1,
-// 	    typename A2,
-// 	    typename A3,
-// 	    typename A4 = none,
-// 	    typename A5 = none,
-// 	    typename A6 = none,
-// 	    typename A7 = none,
-// 	    typename A8 = none>
-//   struct and_list_ : private multiple_assert_< internal::is_bexpr_or_none_<A1>,
-// 					   internal::is_bexpr_or_none_<A2>,
-// 					   internal::is_bexpr_or_none_<A3>,
-// 					   internal::is_bexpr_or_none_<A4>,
-// 					   internal::is_bexpr_or_none_<A5>,
-// 					   internal::is_bexpr_or_none_<A6>,
-// 					   internal::is_bexpr_or_none_<A7>,
-// 					   internal::is_bexpr_or_none_<A8> >,
-// 		     public internal::and_list_< typename internal::va_eval_<A1>::ret,
-// 						 typename internal::va_eval_<A2>::ret,
-// 						 typename internal::va_eval_<A3>::ret,
-// 						 typename internal::va_eval_<A4>::ret,
-// 						 typename internal::va_eval_<A5>::ret,
-// 						 typename internal::va_eval_<A6>::ret,
-// 						 typename internal::va_eval_<A7>::ret,
-// 						 typename internal::va_eval_<A8>::ret >
-//   {
-//   };
+
+  /// Internal helpers for logical operators between several Boolean types
+
+  namespace internal
+  {
+    // FIXME: doc
+
+    template <typename A>
+    struct is_bexpr_or_none_ : public true_ // FIXME: pb using mlc_is_a because of circular deps
+    {
+    };
+
+
+    // va_eval_
+
+    template <typename A>
+    struct va_eval_
+    {
+      typedef typename A::eval ret;
+    };
+
+    template <>
+    struct va_eval_ <none>
+    {
+      typedef none ret;
+    };
+
+
+    // or_list_2_
+
+    template <typename A1, typename A2>
+    struct or_list_2_
+      : public or_<A1, A2>::eval
+    {};
+
+    template <>
+    struct or_list_2_ <none, none>
+      : public false_
+    {};
+
+    template <typename A1>
+    struct or_list_2_ <A1, none>
+      : public A1
+    {};
+
+    template <typename A2>
+    struct or_list_2_ <none, A2>; // forbidden
+
+    // or_list_4_
+
+    template <typename A1, typename A2, typename A3, typename A4>
+    struct or_list_4_
+      : public or_list_2_< typename or_list_2_<A1, A2>::eval,
+			   typename or_list_2_<A3, A4>::eval >::eval
+    {};
+
+    template <>
+    struct or_list_4_ <none, none, none, none>
+      : public false_
+    {};
+
+    // or_list_
+
+    template <typename A1, typename A2, typename A3, typename A4,
+	      typename A5, typename A6, typename A7, typename A8>
+    struct or_list_
+      : public or_list_2_< typename or_list_4_<A1, A2, A3, A4>::eval,
+			   typename or_list_4_<A5, A6, A7, A8>::eval >::eval
+    {};
+
+
+    // and_list_2_
+
+    template <typename A1, typename A2>
+    struct and_list_2_
+      : public and_<A1, A2>::eval
+    {};
+
+    template <>
+    struct and_list_2_ <none, none>
+      : public true_
+    {};
+
+    template <typename A1>
+    struct and_list_2_ <A1, none>
+      : public A1
+    {};
+
+    template <typename A2>
+    struct and_list_2_ <none, A2>; // forbidden
+
+    // and_list_4_
+
+    template <typename A1, typename A2, typename A3, typename A4>
+    struct and_list_4_
+      : public and_list_2_< typename and_list_2_<A1, A2>::eval,
+			    typename and_list_2_<A3, A4>::eval >::eval
+    {};
+
+    template <>
+    struct and_list_4_ <none, none, none, none>
+      : public true_
+    {};
+
+    // and_list_
+
+    template <typename A1, typename A2, typename A3, typename A4,
+	      typename A5, typename A6, typename A7, typename A8>
+    struct and_list_
+      : public and_list_2_< typename and_list_4_<A1, A2, A3, A4>::eval,
+			    typename and_list_4_<A5, A6, A7, A8>::eval >::eval
+    {};
+
+  } // end of mlc::internal
+
+
+
+  /*! \class mlc::or_list_<..>
+  **
+  ** Logical n-ary 'or' operator on a set of Boolean expression types.
+  ** The number of arguments (parameters) should be at least 3 and at
+  ** most 8.  This class is also a Boolean expression type.
+  **
+  ** Sample use:
+  ** mlc::or_list_< mlc::eq_<T, int>,
+  **                mlc_is_a(T, mlc::int_),
+  **                mlc_is_a(T, my::integer) >
+  **
+  ** \see mlc::or_<L,R> mlc::and_list_<..>
+  */
+
+  template <typename A1,
+	    typename A2,
+	    typename A3,
+	    typename A4 = none,
+	    typename A5 = none,
+	    typename A6 = none,
+	    typename A7 = none,
+	    typename A8 = none>
+  struct or_list_ : private multiple_assert_< internal::is_bexpr_or_none_<A1>,
+					      internal::is_bexpr_or_none_<A2>,
+					      internal::is_bexpr_or_none_<A3>,
+					      internal::is_bexpr_or_none_<A4>,
+					      internal::is_bexpr_or_none_<A5>,
+					      internal::is_bexpr_or_none_<A6>,
+					      internal::is_bexpr_or_none_<A7>,
+					      internal::is_bexpr_or_none_<A8> >,
+		    public internal::or_list_< typename internal::va_eval_<A1>::ret,
+					       typename internal::va_eval_<A2>::ret,
+					       typename internal::va_eval_<A3>::ret,
+					       typename internal::va_eval_<A4>::ret,
+					       typename internal::va_eval_<A5>::ret,
+					       typename internal::va_eval_<A6>::ret,
+					       typename internal::va_eval_<A7>::ret,
+					       typename internal::va_eval_<A8>::ret >
+  {
+  };
+
+
+
+  /*! \class mlc::and_list_<..>
+  **
+  ** Logical n-ary 'and' operator on a set of Boolean expression types.
+  ** The number of arguments (parameters) should be at least 3 and at
+  ** most 8.  This class is also a Boolean expression type.
+  **
+  ** \see mlc::and_<L,R> mlc::or_list_<..>
+  */
+
+  template <typename A1,
+	    typename A2,
+	    typename A3,
+	    typename A4 = none,
+	    typename A5 = none,
+	    typename A6 = none,
+	    typename A7 = none,
+	    typename A8 = none>
+  struct and_list_ : private multiple_assert_< internal::is_bexpr_or_none_<A1>,
+					       internal::is_bexpr_or_none_<A2>,
+					       internal::is_bexpr_or_none_<A3>,
+					       internal::is_bexpr_or_none_<A4>,
+					       internal::is_bexpr_or_none_<A5>,
+					       internal::is_bexpr_or_none_<A6>,
+					       internal::is_bexpr_or_none_<A7>,
+					       internal::is_bexpr_or_none_<A8> >,
+		     public internal::and_list_< typename internal::va_eval_<A1>::ret,
+						 typename internal::va_eval_<A2>::ret,
+						 typename internal::va_eval_<A3>::ret,
+						 typename internal::va_eval_<A4>::ret,
+						 typename internal::va_eval_<A5>::ret,
+						 typename internal::va_eval_<A6>::ret,
+						 typename internal::va_eval_<A7>::ret,
+						 typename internal::va_eval_<A8>::ret >
+  {
+  };
 
 
 } // end of namespace mlc
Index: mlc/assert.hh
--- mlc/assert.hh	(revision 431)
+++ mlc/assert.hh	(working copy)
@@ -28,6 +28,8 @@
 #ifndef METALIC_ASSERT_HH
 # define METALIC_ASSERT_HH
 
+# include <mlc/flags.hh>
+
 
 
 namespace mlc
@@ -89,7 +91,7 @@
     
   struct no_bexpr
   {
-    typedef dummy is_true;
+    typedef mlc::dummy is_true;
   };
 
 
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                    
                        https://svn.lrde.epita.fr/svn/oln/trunk/static
Index: ChangeLog
from  Roland Levillain  <roland(a)lrde.epita.fr>
	Catch up with changes in Metalic.
	* stc/properties.hh (stc_equip_namespace_with_properties): Use
	mlc_bool to extract the value of mlc::abstract::bexpr's.
	* stc/properties.hh: Update test (use mlc::assert_).
 stc/properties.hh   |    4 ++--
 tests/properties.cc |   20 ++++++++++----------
 2 files changed, 12 insertions(+), 12 deletions(-)
Index: tests/properties.cc
--- tests/properties.cc	(revision 429)
+++ tests/properties.cc	(working copy)
@@ -1,6 +1,6 @@
 #include <stc/properties.hh>
 #include <mlc/cmp.hh>
-
+#include <mlc/assert.hh>
 
 // FIXME: Split this test into several smaller tests?  For instance,
 // we have to test inheritance, properties/associated types,
@@ -149,17 +149,17 @@
 main()
 {
   // Check types associated to A.
-  mlc_eq(my::A::foo_type, int)::ensure ();
-  mlc_eq(my::A::bar_type, float)::ensure ();
+  mlc::assert_<mlc_eq(my::A::foo_type, int)>::check();
+  mlc::assert_<mlc_eq(my::A::bar_type, float)>::check();
 
   // Check types associated to B.
-  mlc_neq(my::B::bar_type, my::A::bar_type)::ensure ();
-  mlc_eq(my::B::baz_type, char)::ensure ();
-  mlc_eq(my::B::quux_type, long)::ensure ();
-  mlc_eq(my::B::yin_type, unsigned long)::ensure ();
+  mlc::assert_<mlc_neq(my::B::bar_type, my::A::bar_type)>::check();
+  mlc::assert_<mlc_eq(my::B::baz_type, char)>::check();
+  mlc::assert_<mlc_eq(my::B::quux_type, long)>::check();
+  mlc::assert_<mlc_eq(my::B::yin_type, unsigned long)>::check();
 
   // Check types associated to C.
-  mlc_eq(my::C::foo_type, int)::ensure ();
-  mlc_eq(my::C::quux_type, long)::ensure ();
-  mlc_eq(my::C::zorg_type, double)::ensure ();
+  mlc::assert_<mlc_eq(my::C::foo_type, int)>::check();
+  mlc::assert_<mlc_eq(my::C::quux_type, long)>::check();
+  mlc::assert_<mlc_eq(my::C::zorg_type, double)>::check();
 }
Index: stc/properties.hh
--- stc/properties.hh	(revision 429)
+++ stc/properties.hh	(working copy)
@@ -333,9 +333,9 @@
 									      \
     /* Did we found the virtual type? */				      \
     static const bool found_external_p =				      \
-      mlc::is_found<external_typedef>::value;				      \
+      mlc_bool(mlc::is_found<external_typedef>);			      \
     static const bool found_internal_p =				      \
-      mlc::is_found<internal_typedef>::value;				      \
+      mlc_bool(mlc::is_found<internal_typedef>);			      \
 									      \
     typedef typename							      \
     internal::select_typedef<found_external_p, found_internal_p,	      \
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    21 Mar '06
                    
                        
https://svn.lrde.epita.fr/svn/oln/trunk/metalic
Index: ChangeLog
from  Thierry Geraud  <theo(a)lrde.epita.fr>
	Disambiguate Boolean value types and Boolean expression types.
	* tests/ret.cc: Update.
	* mlc/ret.hh: Fix missing include.
	The Boolean value classes are re-written and internal::value_ is
	removed; this class was too ambiguous since precise types, e.g.,
	int_<i>, are provided and it was weirdly located in the value class
	hierarchy.
	* mlc/bool.hh (bool_<true>, bool_<false>): Merge those
	specializations into the single and once for all written class
	bool_<b>.
	(bool_<true>::is_true): Remove since this mark is now factored
	in the base class bexpr_is_<b>.
	(bool_<b>): Add inheritance so that a Boolean value can be
	considered as a Boolean expression type.
	(internal::value_<bool, b>): Remove this specialization since
	the class internal::value_ is also removed.
	(logic.hh): Remove inclusion.
	(mlc_bool): Move to...
	The Boolean expression types are now handled by special classes.
	Yet mlc::true_ and mlc::false_ remain expression types in addition
	of value types.
	* mlc/bexpr.hh: ...this file.  This macro only applies on Boolean
	expression types.
	(bexpr_): Remove this obsolete wrapper.
	(bexpr_is_<b>): New base class with its couple of specializations
	which act as a replacement for bool_<b> for expression types.
	(internal::bool_of_): Replace the meta-code for mlc_bool.
	Those changes induce a lot of updates described below.
	* mlc/pair.hh: Update includes.
	* mlc/logic.hh: Update.  Instead of deriving from bool_<b>
	Boolean expression types now derive from bexpr_is_<b>.
	(and_list_, or_list_): Comment to postpone updating while keeping
	code compile.
	* mlc/implies.hh: Update inheritance.
	* mlc/if.hh: Update includes and add assertion.
	* mlc/assert.hh: Update includes.
	* mlc/valist.hh: Likewise.
	* mlc/wrap.hh: Remove obsolete code.
	* mlc/is_a.hh: Update inheritance.
	(bexpr_): Replace by wrap_.
	* mlc/case.hh: Update.  Now use mlc_bool instead of ::value.
	* mlc/cmp.hh: Update inheritance.
	(eq_::ensure): Remove this obsolete feature.
	* mlc/value.hh: Move sub-classes of value to...
	* mlc/int.hh, mlc/char.hh: ...these new files.
	* mlc/values.hh: New file that includes the whole value types material.
 mlc/assert.hh  |    7 
 mlc/bexpr.hh   |  139 ++++++++++++++++++-
 mlc/bool.hh    |  168 ++---------------------
 mlc/case.hh    |   33 ++--
 mlc/char.hh    |   51 +++++++
 mlc/cmp.hh     |   20 +-
 mlc/if.hh      |    9 -
 mlc/implies.hh |    6 
 mlc/int.hh     |   88 ++++++++++++
 mlc/is_a.hh    |   13 -
 mlc/logic.hh   |  403 ++++++++++++++++++++++++++++-----------------------------
 mlc/pair.hh    |    3 
 mlc/ret.hh     |    1 
 mlc/valist.hh  |    2 
 mlc/value.hh   |  133 ++----------------
 mlc/values.hh  |   49 ++++++
 mlc/wrap.hh    |   55 -------
 tests/ret.cc   |    4 
 18 files changed, 610 insertions(+), 574 deletions(-)
Index: tests/ret.cc
--- tests/ret.cc	(revision 428)
+++ tests/ret.cc	(working copy)
@@ -12,6 +12,6 @@
 
 int main()
 {
-  std::cout << mlc::ret_found_in_<yes>::value << std::endl;
-  std::cout << mlc::ret_found_in_<no>::value << std::endl;
+  std::cout << mlc_bool( mlc::ret_found_in_<yes> ) << std::endl;
+  std::cout << mlc_bool( mlc::ret_found_in_<no>  ) << std::endl;
 }
Index: mlc/ret.hh
--- mlc/ret.hh	(revision 428)
+++ mlc/ret.hh	(working copy)
@@ -29,6 +29,7 @@
 # define METALIC_RET_HH
 
 # include <mlc/typedef.hh>
+# include <mlc/cmp.hh>
 
 
 
Index: mlc/int.hh
--- mlc/int.hh	(revision 0)
+++ mlc/int.hh	(revision 0)
@@ -0,0 +1,88 @@
+// Copyright (C) 2005, 2006 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef METALIC_INT_HH
+# define METALIC_INT_HH
+
+# include <mlc/value.hh>
+
+
+
+/// Internal macros.
+
+# define mlc_internal_decl_unsigned_integer(Type, TypeName)	\
+template <Type val>						\
+struct TypeName : public abstract::unsigned_integer		\
+{								\
+  typedef Type type;						\
+  static const Type value = val;				\
+}
+
+
+# define mlc_internal_decl_signed_integer(Type, TypeName)	\
+template <Type val>						\
+struct TypeName : public abstract::signed_integer		\
+{								\
+  typedef Type type;						\
+  static const Type value = val;				\
+}
+
+
+
+namespace mlc {
+
+
+  namespace abstract {
+
+    /// Abstractions for integer values as types.
+
+    struct          integer : public value   {};
+    struct unsigned_integer : public integer {};
+    struct   signed_integer : public integer {};
+    
+  } // end of namespace mlc::abstract
+
+
+
+  // Dedicated sub-classes for builtin types.
+
+  mlc_internal_decl_unsigned_integer( unsigned char,  uchar_ );
+  mlc_internal_decl_unsigned_integer( unsigned short, ushort_ );
+  mlc_internal_decl_unsigned_integer( unsigned int,   uint_   );
+  mlc_internal_decl_unsigned_integer( unsigned long,  ulong_  );
+
+  mlc_internal_decl_signed_integer(     signed char,  schar_ );
+  mlc_internal_decl_signed_integer(     signed short, short_ );
+  mlc_internal_decl_signed_integer(     signed int,   int_   );
+  mlc_internal_decl_signed_integer(     signed long,  long_  );
+
+
+} // end of namespace mlc
+
+
+
+#endif // ! METALIC_INT_HH
Index: mlc/bool.hh
--- mlc/bool.hh	(revision 428)
+++ mlc/bool.hh	(working copy)
@@ -29,17 +29,7 @@
 # define METALIC_BOOL_HH
 
 # include <mlc/value.hh>
-# include <mlc/flags.hh>
-
-
-/*! \def mlc_bool(Bexpr)
-**
-** Macro that retrieves a Boolean value from a Boolean expression type.
-** Its result is either true or false.
-*/
-# define mlc_bool(Bexpr)  mlc::internal::get_bool<Bexpr>::value
-
-
+# include <mlc/bexpr.hh>
 
 
 namespace mlc
@@ -49,12 +39,10 @@
 
     /*! \class mlc::abstract::boolean
     **
-    ** Abstract base class for Booleans represented as types.  This
-    ** class has two important sub-classes: mlc::true_ and
-    ** mlc::false_.
-    **
-    ** Any mlc Boolean expression type derives from either mlc::true_
-    ** or mlc::false_ so derives from mlc::abstract::boolean.
+    ** Abstract base class for Boolean values represented as types.
+    ** This class has exactly one sub-class: mlc::bool_<b> where b is
+    ** either true or false.  Thanks to aliases, mlc::bool_<true> and
+    ** mlc::bool_<false> are respectively mlc::true_ and mlc::false_.
     */
     
     struct boolean : public value {};
@@ -62,40 +50,16 @@
   } // end of mlc::abstract
 
 
-  // fwd decl
-  template <bool> struct bool_;
-
-
-  namespace internal
-  {
-
-    /*! \class mlc::get_bool<T>
-    **
-    ** Internal class so do not use it.  This class gives access to a
-    ** Boolean value from a Boolean expression type; it is used in the
-    ** mlc_bool(T) macro.
-    **
-    ** \see mlc_bool(T)
-    */
-    template <typename T>
-    struct get_bool
-    {
-      static const bool value = T::bool_value_;
-    };
-
 
-    /*! \class mlc::value_<bool, b>
-    **
-    ** Specialization of value_<T, val> for the Boolean case.
+  /*! \class mlc::bool_<b>
     **
-    ** Design notes: 1) This specialization is defined so that mlc
-    ** Booleans derive from mlc::abstract::boolean.  2) This
-    ** specialization conforms to the interface of the generic version
-    ** of mlc::internal::value_.
+  ** Value type corresponding to bool.
     */
 
     template <bool b>
-    struct value_ <bool, b> : public abstract::boolean
+  struct bool_ : public bexpr_is_<b>,
+		 public abstract::boolean
+		 
     {
       /*! \typedef type
       **
@@ -112,129 +76,29 @@
       ** This member is provided for any mlc value class such as
       ** mlc::int_<51> and mlc::char_<'c'>.  However, to access the
       ** regular value of a type T that you know to be a mlc Boolean
-      ** expression, you should prefer to use the macro mlc_bool(T).
-      ** This macro also ensures that T really is an expression.
+    ** expression, you should prefer to use the macro mlc_value(T).
+    ** This macro also ensures that T is a mlc value type.
       ** 
       */
       static const bool value = b;
-
-      /*! \typedef eval
-      **
-      ** Returns mlc::true_ or mlc::false_.
-      **
-      ** Since Boolean expression types derive from either mlc::true_
-      ** or mlc::false_, these expression types are never exactly
-      ** mlc::true_ nor mlc::false_.  This typedef thus allows for the
-      ** expression evaluation.
-      **
-      ** Please note that, however, we usually do not need expression
-      ** evaluation.  The most common use of a Boolean expression is
-      ** to check that it is verified (true) and, for that, we provide
-      ** "assert_<bexpr, errmsg>::check()".  For instance:
-      ** assert_< or_<mlc_is_a(T, int), mlc_is_a(T, unsigned)> >::check();
-      ** ensures that T is int or unsigned without using ::eval.
-      **
-      ** \see mlc::true_, mlc::false_, mlc::assert_<bexpr, errmsg>.
-      */
-      typedef bool_<b> eval;
-
-    private:
-
-      /*! \member bool_value_
-      **
-      ** This member is redundant with the member 'value'.  It is used
-      ** by the mlc_bool(T) macro to ensure that T actually derives
-      ** from mlc::true_ or mlc::false_.
-      */
-      static const bool bool_value_ = b;
-
-      template <typename T> friend class get_bool;
     };
 
 
-  } // end of namespace mlc::internal
-
-
-
-  /*! \class mlc::bool_<true>
-  **
-  ** Specialization of mlc::bool_<b> for b set to true.  This type
-  ** is also known as mlc::true_.  Every Boolean expression types
-  ** derive either from this type or from mlc::false_.
-  **
-  ** Design notes: 1) This specialization is defined so that mlc
-  ** Booleans derive from mlc::abstract::boolean.  2) This
-  ** specialization conforms to the interface of the generic version
-  ** of mlc::internal::value_.
+  /*! \def mlc::true_
   **
-  ** \see mlc::bool_<false>
+  ** This is an alias (typedef) for mlc::bool_<true>.
   */
-
-  template <>
-  struct bool_<true> : public internal::value_<bool, true>
-  {
-
-    // FIXME: doc
-    using internal::value_<bool, true>::value;
-    using internal::value_<bool, true>::eval;
-
-    /*! \typedef is_true
-    **
-    ** You should not use this typedef.
-    **
-    ** This typedef is inherited in every Boolean expression types
-    ** that derive from mlc::true_.  This typedef is not provided in
-    ** mlc::false_.  The type returned by this typedef has no meaning
-    ** (and thus no significant value).  Static checks via
-    ** "mlc::assert_<bexpr, err>" rely on the presence or absence of
-    ** this typedef.
-    **
-    ** \see mlc::assert_<bexpr, err>
-    */
-    typedef dummy is_true;
-
-  };
-
   typedef bool_<true>  true_;
 
 
-  /*! \class mlc::bool_<false>
-  **
-  ** Specialization of mlc::bool_<b> for b set to false.  This type
-  ** is also known as mlc::false_.  Every Boolean expression types
-  ** derive either from this type or from mlc::true_.
-  **
-  ** Conversely to mlc::true_, this class does not feature the typedef
-  ** "is_true".  So, when a Boolean expression type, say Expr, is
-  ** evaluated to false, the static checks via "assert_<Expr>"
-  ** do not compile.
-  **
-  ** Design notes: 1) This specialization is defined so that mlc
-  ** Booleans derive from mlc::abstract::boolean.  2) This
-  ** specialization conforms to the interface of the generic version
-  ** of mlc::internal::value_.
+  /*! \def mlc::false_
   **
-  ** \see mlc::bool_<true>, mlc::assert_<bexpr, errmsg>
+  ** This is an alias (typedef) for mlc::bool_<false>.
   */
-
-  template <>
-  struct bool_<false> : public internal::value_<bool, false>
-  {
-    // FIXME: doc
-  private:
-    typedef internal::value_<bool, false> super_type;
-  public:
-    using super_type::value;
-    using super_type::eval;
-  };
-
   typedef bool_<false> false_;
 
 
 } // end of namespace mlc
 
 
-# include <mlc/logic.hh>
-
-
 #endif // ! METALIC_BOOL_HH
Index: mlc/pair.hh
--- mlc/pair.hh	(revision 428)
+++ mlc/pair.hh	(working copy)
@@ -28,7 +28,8 @@
 #ifndef METALIC_PAIR_HH
 # define METALIC_PAIR_HH
 
-# include <mlc/bool.hh>
+# include <mlc/assert.hh>
+# include <mlc/logic.hh>
 # include <mlc/uint.hh>
 
 
Index: mlc/logic.hh
--- mlc/logic.hh	(revision 428)
+++ mlc/logic.hh	(working copy)
@@ -28,9 +28,8 @@
 #ifndef METALIC_LOGIC_HH
 # define METALIC_LOGIC_HH
 
-# include <mlc/bool.hh>
+# include <mlc/bexpr.hh>
 # include <mlc/assert.hh>
-# include <mlc/flags.hh>
 
 
 
@@ -44,7 +43,7 @@
   */
   template <typename T>
   struct not_
-    : public bool_<( !mlc_bool(T) )>
+    : public bexpr_is_<( !mlc_bool(T) )>
   {};
 
 
@@ -57,7 +56,7 @@
   */
   template <typename L, typename R>
   struct and_
-    : public bool_<( mlc_bool(L) && mlc_bool(R) )>
+    : public bexpr_is_<( mlc_bool(L) && mlc_bool(R) )>
   {};
 
 
@@ -70,7 +69,7 @@
   */
   template <typename L, typename R>
   struct nand_
-    : public bool_<( !(mlc_bool(L) && mlc_bool(R)) )>
+    : public bexpr_is_<( !(mlc_bool(L) && mlc_bool(R)) )>
   {}; 
 
 
@@ -83,7 +82,7 @@
   */
   template <typename L, typename R>
   struct or_
-    : public bool_<( mlc_bool(L) || mlc_bool(R) )>
+    : public bexpr_is_<( mlc_bool(L) || mlc_bool(R) )>
   {};
 
 
@@ -96,7 +95,7 @@
   */
   template <typename L, typename R>
   struct nor_
-    : public bool_<( !(mlc_bool(L) || mlc_bool(R)) )>
+    : public bexpr_is_<( !(mlc_bool(L) || mlc_bool(R)) )>
   {};
 
 
@@ -107,7 +106,7 @@
   */
   template <typename L, typename R>
   struct xor_
-    : public bool_<( mlc_bool(L) != mlc_bool(R) )>
+    : public bexpr_is_<( mlc_bool(L) != mlc_bool(R) )>
   {};
 
 
@@ -118,204 +117,204 @@
   */
   template <typename L, typename R>
   struct xnor_
-    : public bool_<( !(mlc_bool(L) != mlc_bool(R)) )>
+    : public bexpr_is_<( !(mlc_bool(L) != mlc_bool(R)) )>
   {};
   
 
-  /// Internal helpers for logical operators between several Boolean types
+//   /// Internal helpers for logical operators between several Boolean types
 
-  namespace internal
-  {
-    // FIXME: doc
-
-    template <typename A>
-    struct is_bexpr_or_none_ : public true_ // FIXME: pb using mlc_is_a because of circular deps
-    {
-    };
-
-
-    // va_eval_
-
-    template <typename A>
-    struct va_eval_
-    {
-      typedef typename A::eval ret;
-    };
-
-    template <>
-    struct va_eval_ <none>
-    {
-      typedef none ret;
-    };
-
-
-    // or_list_2_
-
-    template <typename A1, typename A2>
-    struct or_list_2_
-      : public or_<A1, A2>::eval
-    {};
-
-    template <>
-    struct or_list_2_ <none, none>
-      : public true_
-    {};
-
-    template <typename A1>
-    struct or_list_2_ <A1, none>
-      : public A1
-    {};
-
-    template <typename A2>
-    struct or_list_2_ <none, A2>; // forbidden
-
-    // or_list_4_
-
-    template <typename A1, typename A2, typename A3, typename A4>
-    struct or_list_4_
-      : public or_list_2_< typename or_list_2_<A1, A2>::eval,
-			   typename or_list_2_<A3, A4>::eval >::eval
-    {};
-
-    template <>
-    struct or_list_4_ <none, none, none, none>
-      : public true_
-    {};
-
-    // or_list_
-
-    template <typename A1, typename A2, typename A3, typename A4,
-	      typename A5, typename A6, typename A7, typename A8>
-    struct or_list_
-      : public or_list_2_< typename or_list_4_<A1, A2, A3, A4>::eval,
-			   typename or_list_4_<A5, A6, A7, A8>::eval >::eval
-    {};
-
-
-    // and_list_2_
-
-    template <typename A1, typename A2>
-    struct and_list_2_
-      : public and_<A1, A2>::eval
-    {};
-
-    template <>
-    struct and_list_2_ <none, none>
-      : public true_
-    {};
-
-    template <typename A1>
-    struct and_list_2_ <A1, none>
-      : public A1
-    {};
-
-    template <typename A2>
-    struct and_list_2_ <none, A2>; // forbidden
-
-    // and_list_4_
-
-    template <typename A1, typename A2, typename A3, typename A4>
-    struct and_list_4_
-      : public and_list_2_< typename and_list_2_<A1, A2>::eval,
-			    typename and_list_2_<A3, A4>::eval >::eval
-    {};
-
-    template <>
-    struct and_list_4_ <none, none, none, none>
-      : public true_
-    {};
-
-    // and_list_
-
-    template <typename A1, typename A2, typename A3, typename A4,
-	      typename A5, typename A6, typename A7, typename A8>
-    struct and_list_
-      : public and_list_2_< typename and_list_4_<A1, A2, A3, A4>::eval,
-			    typename and_list_4_<A5, A6, A7, A8>::eval >::eval
-    {};
-
-  } // end of mlc::internal
-
-
-
-  /*! \class mlc::or_list_<..>
-  **
-  ** Logical n-ary 'or' operator on a set of Boolean expression types.
-  ** The number of arguments (parameters) should be at least 3 and at
-  ** most 8.  This class is also a Boolean expression type.
-  **
-  ** Sample use:
-  ** mlc::or_list_< mlc::eq_<T, int>,
-  **                mlc_is_a(T, mlc::int_),
-  **                mlc_is_a(T, my::integer) >
-  **
-  ** \see mlc::or_<L,R> mlc::and_list_<..>
-  */
-
-  template <typename A1,
-	    typename A2,
-	    typename A3,
-	    typename A4 = none,
-	    typename A5 = none,
-	    typename A6 = none,
-	    typename A7 = none,
-	    typename A8 = none>
-  struct or_list_ : private multiple_assert_< internal::is_bexpr_or_none_<A1>,
-					  internal::is_bexpr_or_none_<A2>,
-					  internal::is_bexpr_or_none_<A3>,
-					  internal::is_bexpr_or_none_<A4>,
-					  internal::is_bexpr_or_none_<A5>,
-					  internal::is_bexpr_or_none_<A6>,
-					  internal::is_bexpr_or_none_<A7>,
-					  internal::is_bexpr_or_none_<A8> >,
-		    public internal::or_list_< typename internal::va_eval_<A1>::ret,
-					       typename internal::va_eval_<A2>::ret,
-					       typename internal::va_eval_<A3>::ret,
-					       typename internal::va_eval_<A4>::ret,
-					       typename internal::va_eval_<A5>::ret,
-					       typename internal::va_eval_<A6>::ret,
-					       typename internal::va_eval_<A7>::ret,
-					       typename internal::va_eval_<A8>::ret >
-  {
-  };
-
-
-
-  /*! \class mlc::and_list_<..>
-  **
-  ** Logical n-ary 'and' operator on a set of Boolean expression types.
-  ** The number of arguments (parameters) should be at least 3 and at
-  ** most 8.  This class is also a Boolean expression type.
-  **
-  ** \see mlc::and_<L,R> mlc::or_list_<..>
-  */
-
-  template <typename A1,
-	    typename A2,
-	    typename A3,
-	    typename A4 = none,
-	    typename A5 = none,
-	    typename A6 = none,
-	    typename A7 = none,
-	    typename A8 = none>
-  struct and_list_ : private multiple_assert_< internal::is_bexpr_or_none_<A1>,
-					   internal::is_bexpr_or_none_<A2>,
-					   internal::is_bexpr_or_none_<A3>,
-					   internal::is_bexpr_or_none_<A4>,
-					   internal::is_bexpr_or_none_<A5>,
-					   internal::is_bexpr_or_none_<A6>,
-					   internal::is_bexpr_or_none_<A7>,
-					   internal::is_bexpr_or_none_<A8> >,
-		     public internal::and_list_< typename internal::va_eval_<A1>::ret,
-						 typename internal::va_eval_<A2>::ret,
-						 typename internal::va_eval_<A3>::ret,
-						 typename internal::va_eval_<A4>::ret,
-						 typename internal::va_eval_<A5>::ret,
-						 typename internal::va_eval_<A6>::ret,
-						 typename internal::va_eval_<A7>::ret,
-						 typename internal::va_eval_<A8>::ret >
-  {
-  };
+//   namespace internal
+//   {
+//     // FIXME: doc
+
+//     template <typename A>
+//     struct is_bexpr_or_none_ : public true_ // FIXME: pb using mlc_is_a because of circular deps
+//     {
+//     };
+
+
+//     // va_eval_
+
+//     template <typename A>
+//     struct va_eval_
+//     {
+//       typedef typename A::eval ret;
+//     };
+
+//     template <>
+//     struct va_eval_ <none>
+//     {
+//       typedef none ret;
+//     };
+
+
+//     // or_list_2_
+
+//     template <typename A1, typename A2>
+//     struct or_list_2_
+//       : public or_<A1, A2>::eval
+//     {};
+
+//     template <>
+//     struct or_list_2_ <none, none>
+//       : public true_
+//     {};
+
+//     template <typename A1>
+//     struct or_list_2_ <A1, none>
+//       : public A1
+//     {};
+
+//     template <typename A2>
+//     struct or_list_2_ <none, A2>; // forbidden
+
+//     // or_list_4_
+
+//     template <typename A1, typename A2, typename A3, typename A4>
+//     struct or_list_4_
+//       : public or_list_2_< typename or_list_2_<A1, A2>::eval,
+// 			   typename or_list_2_<A3, A4>::eval >::eval
+//     {};
+
+//     template <>
+//     struct or_list_4_ <none, none, none, none>
+//       : public true_
+//     {};
+
+//     // or_list_
+
+//     template <typename A1, typename A2, typename A3, typename A4,
+// 	      typename A5, typename A6, typename A7, typename A8>
+//     struct or_list_
+//       : public or_list_2_< typename or_list_4_<A1, A2, A3, A4>::eval,
+// 			   typename or_list_4_<A5, A6, A7, A8>::eval >::eval
+//     {};
+
+
+//     // and_list_2_
+
+//     template <typename A1, typename A2>
+//     struct and_list_2_
+//       : public and_<A1, A2>::eval
+//     {};
+
+//     template <>
+//     struct and_list_2_ <none, none>
+//       : public true_
+//     {};
+
+//     template <typename A1>
+//     struct and_list_2_ <A1, none>
+//       : public A1
+//     {};
+
+//     template <typename A2>
+//     struct and_list_2_ <none, A2>; // forbidden
+
+//     // and_list_4_
+
+//     template <typename A1, typename A2, typename A3, typename A4>
+//     struct and_list_4_
+//       : public and_list_2_< typename and_list_2_<A1, A2>::eval,
+// 			    typename and_list_2_<A3, A4>::eval >::eval
+//     {};
+
+//     template <>
+//     struct and_list_4_ <none, none, none, none>
+//       : public true_
+//     {};
+
+//     // and_list_
+
+//     template <typename A1, typename A2, typename A3, typename A4,
+// 	      typename A5, typename A6, typename A7, typename A8>
+//     struct and_list_
+//       : public and_list_2_< typename and_list_4_<A1, A2, A3, A4>::eval,
+// 			    typename and_list_4_<A5, A6, A7, A8>::eval >::eval
+//     {};
+
+//   } // end of mlc::internal
+
+
+
+//   /*! \class mlc::or_list_<..>
+//   **
+//   ** Logical n-ary 'or' operator on a set of Boolean expression types.
+//   ** The number of arguments (parameters) should be at least 3 and at
+//   ** most 8.  This class is also a Boolean expression type.
+//   **
+//   ** Sample use:
+//   ** mlc::or_list_< mlc::eq_<T, int>,
+//   **                mlc_is_a(T, mlc::int_),
+//   **                mlc_is_a(T, my::integer) >
+//   **
+//   ** \see mlc::or_<L,R> mlc::and_list_<..>
+//   */
+
+//   template <typename A1,
+// 	    typename A2,
+// 	    typename A3,
+// 	    typename A4 = none,
+// 	    typename A5 = none,
+// 	    typename A6 = none,
+// 	    typename A7 = none,
+// 	    typename A8 = none>
+//   struct or_list_ : private multiple_assert_< internal::is_bexpr_or_none_<A1>,
+// 					  internal::is_bexpr_or_none_<A2>,
+// 					  internal::is_bexpr_or_none_<A3>,
+// 					  internal::is_bexpr_or_none_<A4>,
+// 					  internal::is_bexpr_or_none_<A5>,
+// 					  internal::is_bexpr_or_none_<A6>,
+// 					  internal::is_bexpr_or_none_<A7>,
+// 					  internal::is_bexpr_or_none_<A8> >,
+// 		    public internal::or_list_< typename internal::va_eval_<A1>::ret,
+// 					       typename internal::va_eval_<A2>::ret,
+// 					       typename internal::va_eval_<A3>::ret,
+// 					       typename internal::va_eval_<A4>::ret,
+// 					       typename internal::va_eval_<A5>::ret,
+// 					       typename internal::va_eval_<A6>::ret,
+// 					       typename internal::va_eval_<A7>::ret,
+// 					       typename internal::va_eval_<A8>::ret >
+//   {
+//   };
+
+
+
+//   /*! \class mlc::and_list_<..>
+//   **
+//   ** Logical n-ary 'and' operator on a set of Boolean expression types.
+//   ** The number of arguments (parameters) should be at least 3 and at
+//   ** most 8.  This class is also a Boolean expression type.
+//   **
+//   ** \see mlc::and_<L,R> mlc::or_list_<..>
+//   */
+
+//   template <typename A1,
+// 	    typename A2,
+// 	    typename A3,
+// 	    typename A4 = none,
+// 	    typename A5 = none,
+// 	    typename A6 = none,
+// 	    typename A7 = none,
+// 	    typename A8 = none>
+//   struct and_list_ : private multiple_assert_< internal::is_bexpr_or_none_<A1>,
+// 					   internal::is_bexpr_or_none_<A2>,
+// 					   internal::is_bexpr_or_none_<A3>,
+// 					   internal::is_bexpr_or_none_<A4>,
+// 					   internal::is_bexpr_or_none_<A5>,
+// 					   internal::is_bexpr_or_none_<A6>,
+// 					   internal::is_bexpr_or_none_<A7>,
+// 					   internal::is_bexpr_or_none_<A8> >,
+// 		     public internal::and_list_< typename internal::va_eval_<A1>::ret,
+// 						 typename internal::va_eval_<A2>::ret,
+// 						 typename internal::va_eval_<A3>::ret,
+// 						 typename internal::va_eval_<A4>::ret,
+// 						 typename internal::va_eval_<A5>::ret,
+// 						 typename internal::va_eval_<A6>::ret,
+// 						 typename internal::va_eval_<A7>::ret,
+// 						 typename internal::va_eval_<A8>::ret >
+//   {
+//   };
 
 
 } // end of namespace mlc
Index: mlc/if.hh
--- mlc/if.hh	(revision 428)
+++ mlc/if.hh	(working copy)
@@ -28,7 +28,9 @@
 #ifndef METALIC_IF_HH
 # define METALIC_IF_HH
 
-# include <mlc/bool.hh>
+# include <mlc/bexpr.hh>
+# include <mlc/assert.hh>
+# include <mlc/is_a.hh>
 
 
 /** \def mlc_if(Cond, Then, Else)
@@ -85,7 +87,10 @@
  ** evaluated, whatever the result of \a Cond.
  */
   template <typename cond_type, typename then_type, typename else_type>
-  struct if_ : public internal::if_ < mlc_bool(cond_type), then_type, else_type >
+  struct if_ :
+    // FIXME: enable the static assertion below!!!
+    private assert_< mlc_is_a(cond_type, mlc::abstract::bexpr) >,
+    public internal::if_ < mlc_bool(cond_type), then_type, else_type >
   {
   };
 
Index: mlc/values.hh
--- mlc/values.hh	(revision 0)
+++ mlc/values.hh	(revision 0)
@@ -0,0 +1,49 @@
+// Copyright (C) 2005, 2006 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef METALIC_VALUES_HH
+# define METALIC_VALUES_HH
+
+
+
+/*!
+**
+** This file is provided to group all value types.
+*/
+
+# include <mlc/value.hh>
+# include <mlc/bool.hh>
+# include <mlc/char.hh>
+# include <mlc/int.hh>
+# include <mlc/uint.hh>
+
+
+// ...
+
+
+
+#endif // ! METALIC_VALUES_HH
Index: mlc/assert.hh
--- mlc/assert.hh	(revision 428)
+++ mlc/assert.hh	(working copy)
@@ -28,8 +28,6 @@
 #ifndef METALIC_ASSERT_HH
 # define METALIC_ASSERT_HH
 
-# include <mlc/bool.hh>
-
 
 
 namespace mlc
@@ -228,7 +226,4 @@
 } // end of namespace mlc
 
 
-# include <mlc/logic.hh>
-
-
-#endif // ! METALIC_BOOL_HH
+#endif // ! METALIC_ASSERT_HH
Index: mlc/valist.hh
--- mlc/valist.hh	(revision 428)
+++ mlc/valist.hh	(working copy)
@@ -28,7 +28,7 @@
 #ifndef METALIC_VALIST_HH
 # define METALIC_VALIST_HH
 
-# include <mlc/bool.hh>
+# include <mlc/assert.hh>
 # include <mlc/cmp.hh>
 # include <mlc/uint.hh>
 
Index: mlc/implies.hh
--- mlc/implies.hh	(revision 428)
+++ mlc/implies.hh	(working copy)
@@ -28,7 +28,7 @@
 #ifndef METALIC_IMPLIES_HH
 # define METALIC_IMPLIES_HH
 
-# include <mlc/bool.hh>
+# include <mlc/bexpr.hh>
 
 
 /*! \def mlc_implies(Left_BExpr, Right_BExpr)
@@ -40,7 +40,7 @@
 */
 
 # define mlc_implies(Left_BExpr, Right_BExpr) \
-   typename mlc::implies_<Left_BExpr, Right_BExpr>::ret
+   mlc::bexpr_< typename mlc::implies_<Left_BExpr, Right_BExpr>::ret >
 
 # define mlc_implies_(Left_BExpr, Right_BExpr) \
    mlc::implies_<Left_BExpr, Right_BExpr>::ret
@@ -61,7 +61,7 @@
 
   template <typename L, typename R>
   struct implies_
-    : public bool_<( !mlc_bool(L) || mlc_bool(R) )>
+    : public mlc::bexpr_is_<( !mlc_bool(L) || mlc_bool(R) )>
   {};
 
 } // end of namespace mlc
Index: mlc/wrap.hh
--- mlc/wrap.hh	(revision 428)
+++ mlc/wrap.hh	(working copy)
@@ -28,23 +28,10 @@
 #ifndef METALIC_WRAP_HH
 # define METALIC_WRAP_HH
 
-# include <mlc/is_a.hh>
-
 
 namespace mlc
 {
 
-  /// Forward declarations of types used in specific version of wrap_.
-  /// \{
-  namespace abstract
-  {
-    struct value;
-    struct boolean;
-  }
-  /// \}
-
-
-
   /*! \class mlc::wrap_<T>
   **
   ** This class is a workaround to the problem of implicit typename
@@ -69,48 +56,6 @@
   template <class T>
   struct wrap_ : public T
   {
-    // FIXME: there's no use to unwrap so disabled(?)
-    // typedef T unwrap;
-  };
-
-
-
-  /*! \class mlc::value_wrap_<T>
-  **
-  ** This class acts like mlc::wrap_<T> but is dedicated to 
-  ** value types.  The parameter \a T should be a value type.
-  ** 
-  ** \see mlc::wrap_<T>
-  */
-
-  template <class T>
-  struct value_wrap_ : private assert_< mlc_is_a(T, mlc::abstract::value) >,
-		       public T
-  {
-    typedef typename T::type type;
-    static const T value = T::value;
-  };
-
-
-
-  /*! \class mlc::boolean_wrap_<T>
-  **
-  ** This class acts like mlc::wrap_<T> but is dedicated to Boolean.
-  ** The parameter \a T should be a Boolean expression type.  FIXME:
-  ** there is a confusion between the Boolean value type and Boolean
-  ** expression types!!!
-  ** 
-  ** \see mlc::wrap_<T>
-  */
-
-  template <class T>
-  struct boolean_wrap_ : private assert_< mlc_is_a(T, mlc::abstract::boolean) >,
-			 public T
-  {
-    typedef typename T::type type;
-    static const T value = T::value;
-
-    typedef typename T::eval eval;
   };
 
 
Index: mlc/is_a.hh
--- mlc/is_a.hh	(revision 428)
+++ mlc/is_a.hh	(working copy)
@@ -30,6 +30,7 @@
 
 # include <mlc/bool.hh>
 # include <mlc/bexpr.hh>
+# include <mlc/wrap.hh>
 
 
 // private macro so do _not_ use it
@@ -107,7 +108,7 @@
 
     template<class T,    class U>
     struct ret
-      : public bool_<( mlc_internal_is_a_result_ )>
+      : public mlc::bexpr_is_<( mlc_internal_is_a_result_ )>
     {
     };
   };
@@ -130,7 +131,7 @@
 
     template<class T,    template < class > class U>
     struct ret
-      : public bool_<( mlc_internal_is_a_result_ )>
+      : public mlc::bexpr_is_<( mlc_internal_is_a_result_ )>
     {
     };
   };
@@ -153,7 +154,7 @@
 
     template<class T,    template < class,class > class U>
     struct ret
-      : public bool_<( mlc_internal_is_a_result_ )>
+      : public mlc::bexpr_is_<( mlc_internal_is_a_result_ )>
     {};
   };
 
@@ -175,7 +176,7 @@
 
     template<class T,    template < template < class > class > class U>
     struct ret
-      : public bool_<( mlc_internal_is_a_result_ )>
+      : public mlc::bexpr_is_<( mlc_internal_is_a_result_ )>
     {};
   };
 
@@ -197,7 +198,7 @@
 
     template<class T,    template < template < class,class > class > class U>
     struct ret
-      : public bool_<( mlc_internal_is_a_result_ )>
+      : public mlc::bexpr_is_<( mlc_internal_is_a_result_ )>
     {};
   };
 
@@ -238,7 +239,7 @@
 */
 
 # define mlc_is_a(T, U) \
-mlc::bexpr_< typename mlc::is_a_< sizeof(mlc::form::of< U >()) >::ret< T, U > >
+mlc::wrap_< typename mlc::is_a_< sizeof(mlc::form::of< U >()) >::ret< T, U > >
 
 # define mlc_is_a_(T, U) \
 mlc::is_a_< sizeof(mlc::form::of< U >()) >::ret< T, U >
Index: mlc/case.hh
--- mlc/case.hh	(revision 428)
+++ mlc/case.hh	(working copy)
@@ -198,14 +198,16 @@
 					     mlc::ret_found_in_< NAMESPACE::case_<context, data, i> > >,			\
 			      mlc::ERROR::A_case_STATEMENT_IN_A_switch_SHOULD_HAVE_A_ret >					\
     {																\
-      typedef handle_case_ <													\
-	use,															\
+      typedef mlc_is_a(mlc_comma_2(NAMESPACE::case_<context, data, i+1>),							\
+		       mlc::case_selected) next_case_is_selected;								\
+      typedef mlc_is_a(mlc_comma_2(NAMESPACE::case_<context, data, i+1>),							\
+		       mlc::case_not_selected) next_case_is_not_selected;							\
+																\
+      typedef handle_case_ < use,												\
 	context, data, i+1,													\
-	mlc_is_a(mlc_comma_2(NAMESPACE::case_<context, data, i+1>),								\
-		 mlc::case_selected)::value,											\
-	mlc_is_a(mlc_comma_2(NAMESPACE::case_<context, data, i+1>),								\
-		 mlc::case_not_selected)::value > next_t;									\
-      typedef typename next_t::ret ret;												\
+	                     mlc_bool(next_case_is_selected), mlc_bool(next_case_is_not_selected)				\
+                            > handle_next_case_t;										\
+      typedef typename handle_next_case_t::ret ret;										\
     };																\
 																\
 																\
@@ -217,14 +219,15 @@
 					mlc::locked >,										\
 			      mlc::ERROR::A_case_STATEMENT_SHOULD_NOT_START_AT_INDEX_0_BUT_1 >					\
     {																\
-      typedef handle_case_ <													\
-	use,															\
+      typedef mlc_is_a(mlc_comma_2(NAMESPACE::case_<context, data, 1>),								\
+		       mlc::case_selected) first_case_is_selected;								\
+      typedef mlc_is_a(mlc_comma_2(NAMESPACE::case_<context, data, 1>),								\
+		       mlc::case_not_selected) first_case_is_not_selected;							\
+      typedef handle_case_ < use,												\
 	context, data, 1,													\
-	mlc_is_a(mlc_comma_2(NAMESPACE::case_<context, data, 1>),								\
-		 mlc::case_selected)::value,											\
-	mlc_is_a(mlc_comma_2(NAMESPACE::case_<context, data, 1>),								\
-		 mlc::case_not_selected)::value > handle_t;									\
-      typedef typename handle_t::ret ret;											\
+	                     mlc_bool(first_case_is_selected), mlc_bool(first_case_is_not_selected)				\
+	                   > handle_first_case_t;										\
+      typedef typename handle_first_case_t::ret ret;										\
     };																\
 																\
 																\
@@ -260,7 +263,7 @@
 																\
 }																\
 																\
-struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_o_n											\
+struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_o_n
 
 
 
Index: mlc/value.hh
--- mlc/value.hh	(revision 428)
+++ mlc/value.hh	(working copy)
@@ -29,56 +29,8 @@
 # define METALIC_VALUE_HH
 
 # include <mlc/type.hh>
-// # include <mlc/wrap.hh>
-
-
-
-/** \def mlc_value(T)
- ** \brief Returns the value of a value type.
- **
- ** Only works when \a T is a value type such as mlc::bool_<b> or
- ** mlc::int_<i>.  The result is respectively a bool value and an int
- ** value.  Please prefer using this macro to a direct call to
- ** T::value because such a direct call may not compile (read the
- ** design notes below for details).
- **
- ** Design notes: FIXME: doc
- */
-
-// # define mlc_value(T) mlc::wrap_<T>::value
-
-
-
-/// Internal macros.
-
-
-# define mlc_internal_decl_unsigned_(Type, TypeName)		\
-namespace internal						\
-{								\
-  template <Type val>						\
-  struct value_ <Type, val> : public abstract::unsigned_integer	\
-  {								\
-    typedef Type type;						\
-    static const Type value = val;				\
-  };								\
-}								\
-template <Type val>						\
-struct TypeName : public internal::value_<Type, val> {}
-
-
-# define mlc_internal_decl_signed_(Type, TypeName)		\
-namespace internal						\
-{								\
-  template <Type val>						\
-  struct value_ <Type, val> : public abstract::signed_integer	\
-  {								\
-    typedef Type type;						\
-    static const Type value = val;				\
-  };								\
-}								\
-template <Type val>						\
-struct TypeName : public internal::value_<Type, val> {}
-
+// # include <mlc/assert.hh>
+// # include <mlc/is_a.hh>
 
 
 
@@ -99,86 +51,43 @@
     {
     };
 
-    /// Abstractions for integer values as types.
-
-    struct          integer : public value   {};
-    struct unsigned_integer : public integer {};
-    struct   signed_integer : public integer {};
-    
   } // end of namespace mlc::abstract
 
 
   namespace internal
   {
 
-    /*! \class mlc::internal::value_<T, val>
-    **
-    ** Base class for values to be represented by types.  This class
-    ** is in the internal namespace so you should not use it.  Its
-    ** purpose is only to factor code for derived classes that are not
-    ** internal (for instance, mlc::true_ or mlc::int_<51>).
-    **
-    ** Design note: this class can only be used for values that can be
-    ** a parameter (mlc::internal::value_<float, 3.14f> is incorrect).
-    **
-    ** Parameter T is the type of the value.  Parameter val is the
-    ** value itself.
-    **
-    ** \see mlc/bool.hh
-    */
-    
-    template <typename T, T val>
-    struct value_ : public abstract::value
+    template <typename T>
+    struct value_of_
+    // FIXME: commented below to avoid circular dependances
+    // : private assert_< mlc_is_a(T, mlc::abstract::value) >
     {
-      /*! \typedef type
-      **
-      ** Gives the regular type of the value.  For instance,
-      ** mlc::true_::type is bool and mlc::int_<51>::type is int.
-      */
-      typedef T type;
-
-      /*! \member value
-      **
-      ** Gives the regular value.  For instance,
-      ** mlc::true_::value is true and mlc::int_<51>::value is 51.
-      */
-      static const T value = val;
+      static const typename T::type ret = T::value;
     };
 
   } // end of namespace mlc::internal
 
 
+} // end of namespace mlc
 
 
-  // Dedicated sub-classes for builtin types.
-
-  mlc_internal_decl_unsigned_( unsigned char,  uchar_ );
-  mlc_internal_decl_unsigned_( unsigned short, ushort_ );
-  mlc_internal_decl_unsigned_( unsigned int,   uint_   );
-  mlc_internal_decl_unsigned_( unsigned long,  ulong_  );
-
-  mlc_internal_decl_signed_(     signed char,  schar_ );
-  mlc_internal_decl_signed_(     signed short, short_ );
-  mlc_internal_decl_signed_(     signed int,   int_   );
-  mlc_internal_decl_signed_(     signed long,  long_  );
-
-
-  // char
-
-  template <char c>
-  struct char_ : public internal::value_<char, c>
-  {
-  };
-
-
-  // Boolean values as types are defined elsewhere
-  // see:  mlc/bool.hh
 
+/** \def mlc_value(T)
+ ** \brief Returns the value of a value type.
+ **
+ ** Only works when \a T is a value type such as mlc::bool_<b> or
+ ** mlc::int_<i>.  The result is respectively a bool value and an int
+ ** value; for instance mlc_value(mlc::int_<51>) gives 51.  Please
+ ** prefer using this macro to a direct call to T::value because such
+ ** a direct call may not compile (read the design notes below for
+ ** details).
+ **
+ ** Design notes: FIXME: doc
+ */
 
-} // end of namespace mlc
+# define mlc_value(T) mlc::internal::value_of_<T>::ret
 
 
-# include <mlc/bool.hh>
 
 
 #endif // ! METALIC_VALUE_HH
Index: mlc/char.hh
--- mlc/char.hh	(revision 0)
+++ mlc/char.hh	(revision 0)
@@ -0,0 +1,51 @@
+// Copyright (C) 2005, 2006 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef METALIC_CHAR_HH
+# define METALIC_CHAR_HH
+
+# include <mlc/value.hh>
+
+
+
+namespace mlc
+{
+
+  // char
+
+  template <char c>
+  struct char_ : public abstract::value
+  {
+    typedef char type;
+    static const char value = c;
+  };
+
+
+} // end of namespace mlc
+
+
+#endif // ! METALIC_CHAR_HH
Index: mlc/cmp.hh
--- mlc/cmp.hh	(revision 428)
+++ mlc/cmp.hh	(working copy)
@@ -28,8 +28,9 @@
 #ifndef METALIC_CMP_HH
 # define METALIC_CMP_HH
 
-# include <mlc/bool.hh>
+# include <mlc/bexpr.hh>
 # include <mlc/is_a.hh>
+# include <mlc/logic.hh>
 
 
 /// Macros mlc_eq and mlc_neq.
@@ -59,17 +60,14 @@
   template <typename T1, typename T2>
   struct eq_ : private multiple_assert_< is_not_value<T1>,
 					 is_not_value<T2> >,
-	       public false_
+	       public bexpr_is_<false>
   {
   };
 
   template <typename T>
   struct eq_ <T, T> : private assert_< is_not_value<T> >,
-		      public true_
+		      public bexpr_is_<true>
   {
-    // Solve the ambiguity on ensure(), a static member function
-    // inherited both from true_ and assert_.
-    using true_::ensure;
   };
   /// \}
 
@@ -78,13 +76,13 @@
   template <typename T1, typename T2>
   struct neq_ : private multiple_assert_< is_not_value<T1>,
 					  is_not_value<T2> >,
-		public true_
+		public bexpr_is_<true>
   {
   };
 
   template <typename T>
   struct neq_ <T, T> : private assert_< is_not_value<T> >,
-		       public false_
+		       public bexpr_is_<false>
   {
   };
   /// \}
@@ -110,9 +108,9 @@
 
   /// Check whether a type is a sound (supposedly before using it).
   template <typename T>
-  struct is_ok : public and_list_< neq_<T, not_found>,
-				   neq_<T, not_ok>,
-				   neq_<T, undefined > >
+  struct is_ok : public and_< neq_<T, not_found>,
+			      and_< neq_<T, not_ok>,
+				    neq_<T, undefined > > >
   {
   };
 
Index: mlc/bexpr.hh
--- mlc/bexpr.hh	(revision 428)
+++ mlc/bexpr.hh	(working copy)
@@ -28,25 +28,152 @@
 #ifndef METALIC_BEXPR_HH
 # define METALIC_BEXPR_HH
 
+# include <mlc/type.hh>
+# include <mlc/flags.hh>
+
+
 
 namespace mlc
 {
 
-  /*! \class mlc::bexpr_<T>
+
+  /// Forward declarations for Booleans value type and their aliases.
+  /// \{
+  template <bool b> struct bool_;
+  typedef bool_<true>  true_;
+  typedef bool_<false> false_;
+  /// \}
+
+
+
+  namespace abstract {
+
+    /*! \class mlc::abstract::bexpr
+    **
+    ** Abstract base class for mlc Boolean expression types.
   **
-  ** This class is a wrapper for Boolean expression types.  FIXME: doc
+    ** When you define a new class for a Boolean expression type, you
+    ** should not directly derive from this class from fom its
+    ** subclass: bexpr_is_<b>.
   **
-  ** \see mlc::wrap_<T>
+    ** \see bexpr_is_<b>
   */
 
-  template <class T>
-  struct bexpr_ : public T
+    struct bexpr : public type
   {
-    typedef typename T::eval eval;
+      // typedef void eval;
   };
 
+  } // end of namespace mlc::abstract
+
+
+
+  /*! \class mlc::bexpr_is_<b>
+  **
+  ** Base class for any class of mlc Boolean expression types.
+  ** When you define a new class for a Boolean expression type, you
+  ** should directly derive from this class.
+  **
+  ** This class provides the typedef 'eval' which evaluates to either
+  ** mlc::true_ or mlc::false_ the expression.
+  **
+  ** \see mlc::bexpr_is_<true>, mlc::bexpr_is_<false>
+  */
+
+  template <bool b> struct bexpr_is_;
+
+
+  /*! \class mlc::bexpr_is_<true>
+  **
+  ** Specialization of mlc::bexpr_is_<b> when b is 'true'.  This class
+  ** provides the typedef member 'is_true' to every Boolean expression
+  ** type that evaluates to true_.
+  ** 
+  ** \see mlc::bexpr_is_<b>, mlc::bexpr_is_<false>
+  */
+
+  template <>
+  struct bexpr_is_ < true > : public abstract::bexpr
+  {
+    typedef mlc::true_ eval;
+
+    /*! \typedef is_true
+    **
+    ** This member is inherited in every Boolean expression type that
+    ** evaluates to true_.  Conversely, such member does not appear in
+    ** bexpr_is_<false> so it does not exist in every Boolean
+    ** expression type that evaluates to false_.
+    */
+    typedef mlc::dummy is_true;
+  };
+
+
+  /*! \class mlc::bexpr_is_<false>
+  **
+  ** Specialization of mlc::bexpr_is_<b> when b is 'false'.  This class
+  ** does not provide the typedef member 'is_true' to every Boolean expression
+  ** type that evaluates to false_.
+  ** 
+  ** \see mlc::bexpr_is_<b>, mlc::bexpr_is_<true>
+  */
+
+  template <>
+  struct bexpr_is_ < false > : public abstract::bexpr
+  {
+    typedef mlc::false_ eval;
+  };
+
+
+
+
+  namespace internal
+  {
+
+    /// \class mlc::internal::bool_of_<bexpr>
+    /// \brief Returns the bool value corresponding to a Boolean expression type.
+    /// \note Internal class, don't use it directly.
+
+    template <typename bexpr>
+    struct bool_of_
+    // FIXME: commented below to avoid circular dependances
+    // : private assert_< mlc_is_a(bexpr, mlc::abstract::bexpr) >
+    {
+      // 1) the bexpr evaluates to either mlc::true_ or mlc::false_
+      //    so the expected result comes from the value of b in
+      //    mlc::bool_<b>
+      // 2) retrieving b is performed by the specialization of
+      //    internal::bool_of_ provided few lines below
+      static const bool ret = internal::bool_of_<typename bexpr::eval>::ret;
+    };
+
+    /// \class mlc::internal::bool_of_< mlc::bool_<b> >
+    /// \brief Specialization of mlc::internal::bool_of_<bexpr>
+    /// \note Internal class, don't use it directly.
+    /// \see mlc::internal::bool_of_<bexpr>
+    template <bool b>
+    struct bool_of_ < mlc::bool_<b> >
+    {
+      static const bool ret = b;
+    };
+
+  } // end of namespace mlc::internal
+
 
 } // end of namespace mlc
 
 
+
+
+/** \def mlc_bool(Bexpr)
+ **
+ ** Returns the bool value corresponding to a Boolean expression type.
+ **
+ ** \note Value retrieval is performed by
+ ** mlc::internal::bool_of_<Bexpr>
+ */
+
+# define mlc_bool(Bexpr) mlc::internal::bool_of_<Bexpr>::ret
+
+
+
 #endif // ! METALIC_BEXPR_HH
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                    
                        
https://svn.lrde.epita.fr/svn/oln/trunk/metalic
Index: ChangeLog
from  Thierry Geraud  <theo(a)lrde.epita.fr>
	First step towards explicit bexpr.
	* mlc/bool.hh: Fix doc typo.
	* mlc/TODO: Update.
	* mlc/wrap.hh (unwrap): Remove cause useless.
	(value_wrap_, boolean_wrap_): New dedicated wrappers.
	* mlc/bexpr.hh: New file. It provides an explicit wrapper for Boolean
	expression types; it is a first step towards the disambiguation between
	the Boolean value type and the many Boolean expression types.
	* mlc/is_a.hh (mlc_is_a): Update; now use bexpr_ instead of wrap_.
	* mlc/value.hh (mlc_value): Suggest this macro.
 TODO     |   34 +++++++++++++++++++++++++++++++++-
 bexpr.hh |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 bool.hh  |    2 +-
 is_a.hh  |    4 ++--
 value.hh |   17 +++++++++++++++++
 wrap.hh  |   62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 6 files changed, 166 insertions(+), 5 deletions(-)
Index: mlc/bool.hh
--- mlc/bool.hh	(revision 427)
+++ mlc/bool.hh	(working copy)
@@ -32,7 +32,7 @@
 # include <mlc/flags.hh>
 
 
-/*! \def mlc_bool(&Bexpr)
+/*! \def mlc_bool(Bexpr)
 **
 ** Macro that retrieves a Boolean value from a Boolean expression type.
 ** Its result is either true or false.
Index: mlc/TODO
--- mlc/TODO	(revision 427)
+++ mlc/TODO	(working copy)
@@ -2,4 +2,36 @@
 
 * files
 
-create assert.hh from bool.hh
+** bool.hh
+
+create assert.hh from parts of bool.hh
+
+** boolean and bexpr
+
+there is a confusion between mlc::abstract::boolean and the notion of
+bexpr (Boolean expression type)!
+
+** value.hh
+
+This file mixes bool_, int_, etc. so I should be split into several
+parts and all value-related files should be re-organized.  The current
+situation is weird:  internal::value is not in value.hh;  uint.hh does
+not define mlc::uint_;  etc.
+
+
+* renaming
+
+** cmp.hh
+
+eq_ -> equal_ etc.
+
+** comma.hh
+
+mlc_comma_N -> mlc_cmN  (the shorter the better)
+
+
+* design
+
+** mlc_is_a
+
+It uses wrap_; though, is it really useful?
Index: mlc/wrap.hh
--- mlc/wrap.hh	(revision 427)
+++ mlc/wrap.hh	(working copy)
@@ -28,9 +28,23 @@
 #ifndef METALIC_WRAP_HH
 # define METALIC_WRAP_HH
 
+# include <mlc/is_a.hh>
+
 
 namespace mlc
 {
+
+  /// Forward declarations of types used in specific version of wrap_.
+  /// \{
+  namespace abstract
+  {
+    struct value;
+    struct boolean;
+  }
+  /// \}
+
+
+
   /*! \class mlc::wrap_<T>
   **
   ** This class is a workaround to the problem of implicit typename
@@ -47,14 +61,60 @@
   **
   ** Design note: a detailed example can be read at the end of
   ** the file mlc/wrap.hh
+  **
+  **
+  ** \see mlc::value_wrap_<T>, mlc::bexpr_wrap_<T>
   */
 
   template <class T>
   struct wrap_ : public T
   {
-    typedef T unwrap;
+    // FIXME: there's no use to unwrap so disabled(?)
+    // typedef T unwrap;
+  };
+
+
+
+  /*! \class mlc::value_wrap_<T>
+  **
+  ** This class acts like mlc::wrap_<T> but is dedicated to 
+  ** value types.  The parameter \a T should be a value type.
+  ** 
+  ** \see mlc::wrap_<T>
+  */
+
+  template <class T>
+  struct value_wrap_ : private assert_< mlc_is_a(T, mlc::abstract::value) >,
+		       public T
+  {
+    typedef typename T::type type;
+    static const T value = T::value;
+  };
+
+
+
+  /*! \class mlc::boolean_wrap_<T>
+  **
+  ** This class acts like mlc::wrap_<T> but is dedicated to Boolean.
+  ** The parameter \a T should be a Boolean expression type.  FIXME:
+  ** there is a confusion between the Boolean value type and Boolean
+  ** expression types!!!
+  ** 
+  ** \see mlc::wrap_<T>
+  */
+
+  template <class T>
+  struct boolean_wrap_ : private assert_< mlc_is_a(T, mlc::abstract::boolean) >,
+			 public T
+  {
+    typedef typename T::type type;
+    static const T value = T::value;
+
+    typedef typename T::eval eval;
   };
 
+
+
 } // end of namespace mlc
 
 
Index: mlc/is_a.hh
--- mlc/is_a.hh	(revision 427)
+++ mlc/is_a.hh	(working copy)
@@ -29,7 +29,7 @@
 # define METALIC_IS_A_HH
 
 # include <mlc/bool.hh>
-# include <mlc/wrap.hh>
+# include <mlc/bexpr.hh>
 
 
 // private macro so do _not_ use it
@@ -238,7 +238,7 @@
 */
 
 # define mlc_is_a(T, U) \
-mlc::wrap_< typename mlc::is_a_<sizeof(mlc::form::of<U >())>::ret<T,U > >
+mlc::bexpr_< typename mlc::is_a_< sizeof(mlc::form::of< U >()) >::ret< T, U > >
 
 # define mlc_is_a_(T, U) \
 mlc::is_a_< sizeof(mlc::form::of<U >())>::ret<T,U >
Index: mlc/value.hh
--- mlc/value.hh	(revision 427)
+++ mlc/value.hh	(working copy)
@@ -29,6 +29,23 @@
 # define METALIC_VALUE_HH
 
 # include <mlc/type.hh>
+// # include <mlc/wrap.hh>
+
+
+
+/** \def mlc_value(T)
+ ** \brief Returns the value of a value type.
+ **
+ ** Only works when \a T is a value type such as mlc::bool_<b> or
+ ** mlc::int_<i>.  The result is respectively a bool value and an int
+ ** value.  Please prefer using this macro to a direct call to
+ ** T::value because such a direct call may not compile (read the
+ ** design notes below for details).
+ **
+ ** Design notes: FIXME: doc
+ */
+
+// # define mlc_value(T) mlc::wrap_<T>::value
 
 
 
Index: mlc/bexpr.hh
--- mlc/bexpr.hh	(revision 0)
+++ mlc/bexpr.hh	(revision 0)
@@ -0,0 +1,52 @@
+// Copyright (C) 2006  EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library.  This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING.  If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction.  Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License.  This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef METALIC_BEXPR_HH
+# define METALIC_BEXPR_HH
+
+
+namespace mlc
+{
+
+  /*! \class mlc::bexpr_<T>
+  **
+  ** This class is a wrapper for Boolean expression types.  FIXME: doc
+  **
+  ** \see mlc::wrap_<T>
+  */
+
+  template <class T>
+  struct bexpr_ : public T
+  {
+    typedef typename T::eval eval;
+  };
+
+
+} // end of namespace mlc
+
+
+#endif // ! METALIC_BEXPR_HH
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0