Commit a8b141cb authored by Roland Levillain's avatar Roland Levillain
Browse files

Improve the Point2d and Point3d concepts in mini-oln.

	* samples/mini-oln/concept-c++/mini-oln.cc
	(concepts::Point2d, concepts::Point3d): Enrich them.
	(concept_map Point2d<oln::point2d>)
	(concept_map Point3d<oln::point3d>): Adjust.
	(oln::point2d::coord_type, oln::point3d::coord_type): New
	typedefs.
	(oln::point2d::row, oln::point2d::col)
	(oln::point3d::row, oln::point3d::col, oln::point3d::sli): Use it.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@732 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 14d3548b
2007-02-02 Roland Levillain <roland@lrde.epita.fr>
Improve the Point2d and Point3d concepts in mini-oln.
* samples/mini-oln/concept-c++/mini-oln.cc
(concepts::Point2d, concepts::Point3d): Enrich them.
(concept_map Point2d<oln::point2d>)
(concept_map Point3d<oln::point3d>): Adjust.
(oln::point2d::coord_type, oln::point3d::coord_type): New
typedefs.
(oln::point2d::row, oln::point2d::col)
(oln::point3d::row, oln::point3d::col, oln::point3d::sli): Use it.
2007-02-01 Roland Levillain <roland@lrde.epita.fr>
Add a first C++0x concept-based version of mini-oln.
......
......@@ -61,8 +61,27 @@ mlc_case_equipment_for_namespace(oln);
namespace concepts
{
concept Point2d<typename P> {};
concept Point3d<typename P> {};
// These concepts are not automatic (i.e., prefixed with `auto'),
// since we cannot rely on type signatures for them. For instance,
// using only structural conformance, oln::point3d could be a model
// of concepts::Point2d!
concept Point2d<typename P>
{
typename coord_type;
// For simplicity purpose, the canonical model of
// concepts::Point2d -- oln::point2d -- does not expose its
// interface through methods (that's bad OO software engineering
// practice, but hey, we're just prototyping here). Therefore we
// cannot express sigatures on row and col accesses, since C++0x
// concepts forbid attribute (member) signatures.
};
concept Point3d<typename P>
{
typename coord_type;
// Same remark as above for concepts::Point2d regarding member
// signatures.
};
auto concept Image<typename I>
{
......@@ -110,22 +129,31 @@ namespace oln
struct point2d : public Point<point2d>
{
int row;
int col;
typedef int coord_type;
coord_type row;
coord_type col;
};
struct point3d : public Point<point2d>
{
int row;
int col;
int sli;
typedef int coord_type;
coord_type row;
coord_type col;
coord_type sli;
};
}
namespace concepts
{
concept_map Point2d<oln::point2d> {};
concept_map Point3d<oln::point3d> {};
concept_map Point2d<oln::point2d>
{
typedef oln::point2d::coord_type coord_type;
};
concept_map Point3d<oln::point3d>
{
typedef oln::point2d::coord_type coord_type;
};
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment