Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2003-11-23 20:10:20

> Even if there aren't any other lessons, it seems clear we should be using
> the concept checking library more widely.
> From time-to-time other tales from the trenches might be aditional
> motivators, too.

Inspired by your post I decided to try out some concept checking on my
physical quantities class
using the boost concept checking techniques
The following is a genuine error message, though technically contrived
because I guess VC7.1 has optimised
the A variable... it doesnt always come out as clean !
I guess I should probably use a ConvertibleConcept but ... naming the
function for the error seems more fun !

The end result of this test for me is that concept checking is going to be a
major part of my physical_quantity library :-)

Andy Little

#include "../pq_types/pq_length.hpp"
#include "../pq_types/pq_area.hpp"
#include "../class_template/operations/div.hpp"
using namespace physical_quantities;
int main()
    pq_length<>::m L1(10);
    pq_area<>::m2 A = L1 / (1/L1);
    pq_length<>::mm LL = L1 / (1/L1); //should - does fail d.a. here

------ Build started: Project: physical_quantities, Configuration: Debug
Win32 ------

c:\Projects\physical_quantities\class_template\generic.hpp(27) : error
C2440: 'initializing' : cannot convert from
'physical_quantities::pq_area<>::base' to
        No constructor could take the source type, or constructor overload
resolution was ambiguous
        c:\Projects\physical_quantities\class_template\generic.hpp(150) :
see reference to function template instantiation 'void
ract_pq1>(Abstract_pqA,Abstract_pqB)' being compiled
        c:\Projects\physical_quantities\test\main.cpp(9) : see reference to
function template instantiation
Value_type,0,0,0,null> &)' being compiled

Build log was saved at "xxxxxxx\physical_quantities\Debug\BuildLog.htm"
physical_quantities - 1 error(s), 0 warning(s)

---------------------- Done ----------------------

    Build: 0 succeeded, 1 failed, 0 skipped

Boost list run by bdawes at, gregod at, cpdaniel at, john at