|
From: Matthias S. <mat...@us...> - 2007-03-29 16:48:18
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2954 Modified Files: unit_example_16.cpp Log Message: demonstrates use of trivial_inverse_conversion Index: unit_example_16.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_16.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- unit_example_16.cpp 16 Mar 2007 18:29:52 -0000 1.1.1.1 +++ unit_example_16.cpp 29 Mar 2007 16:48:14 -0000 1.2 @@ -64,26 +64,20 @@ // IO helper class template<> -struct unit_info<nautical::system_tag,length_tag> +struct base_unit_info<length_tag,nautical::system_tag> { static std::string name() { return "nautical mile"; } static std::string symbol() { return "nmi"; } }; -// helpers for conversions between nautical length and SI length +// helper for conversions between nautical length and SI length template<> -struct base_unit_converter<length_tag,nautical::system_tag,SI::system_tag> +struct base_unit_converter<length_tag,nautical::system_tag,SI::system_tag> : + public trivial_inverse_conversion { typedef double type; static type value() { return 1.852e3; } }; - -template<> -struct base_unit_converter<length_tag,SI::system_tag,nautical::system_tag> -{ - typedef double type; - static type value() { return 1.0/1.852e3; } -}; //] //[unit_example_16_class_snippet_2 @@ -103,7 +97,7 @@ // IO helper class template<> -struct unit_info<imperial::system_tag,length_tag> +struct base_unit_info<length_tag,imperial::system_tag> { static std::string name() { return "foot"; } static std::string symbol() { return "ft"; } |