You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(89) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(208) |
Feb
(76) |
Mar
(55) |
Apr
(74) |
May
(43) |
Jun
(116) |
Jul
(109) |
Aug
(46) |
Sep
(36) |
Oct
(106) |
Nov
(159) |
Dec
(128) |
| 2007 |
Jan
(54) |
Feb
(225) |
Mar
(200) |
Apr
(229) |
May
(7) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Matthias S. <mat...@us...> - 2007-04-18 22:25:37
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31596/boost/units/systems Modified Files: physical_units.hpp Log Message: minor Index: physical_units.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/systems/physical_units.hpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- physical_units.hpp 14 Apr 2007 21:53:22 -0000 1.18 +++ physical_units.hpp 18 Apr 2007 22:25:37 -0000 1.19 @@ -30,15 +30,15 @@ namespace units { -struct length_dim : boost::units::base_dimension<length_dim, -9> {}; ///> base dimension of length -struct mass_dim : boost::units::base_dimension<mass_dim,-8> {}; ///> base dimension of mass -struct time_dim : boost::units::base_dimension<time_dim,-7> {}; ///> base dimension of time -struct current_dim : boost::units::base_dimension<current_dim,-6> {}; ///> base dimension of current -struct temperature_dim : boost::units::base_dimension<temperature_dim,-5> {}; ///> base dimension of temperature -struct amount_dim : boost::units::base_dimension<amount_dim,-4> {}; ///> base dimension of amount -struct luminous_intensity_dim : boost::units::base_dimension<luminous_intensity_dim,-3> {}; ///> base dimension of luminous intensity -struct plane_angle_dim : boost::units::base_dimension<plane_angle_dim,-2> {}; ///> base dimension of plane angle -struct solid_angle_dim : boost::units::base_dimension<solid_angle_dim,-1> {}; ///> base dimension of solid angle +struct length_dim : boost::units::base_dimension<length_dim, -9> { }; ///> base dimension of length +struct mass_dim : boost::units::base_dimension<mass_dim,-8> { }; ///> base dimension of mass +struct time_dim : boost::units::base_dimension<time_dim,-7> { }; ///> base dimension of time +struct current_dim : boost::units::base_dimension<current_dim,-6> { }; ///> base dimension of current +struct temperature_dim : boost::units::base_dimension<temperature_dim,-5> { }; ///> base dimension of temperature +struct amount_dim : boost::units::base_dimension<amount_dim,-4> { }; ///> base dimension of amount +struct luminous_intensity_dim : boost::units::base_dimension<luminous_intensity_dim,-3> { }; ///> base dimension of luminous intensity +struct plane_angle_dim : boost::units::base_dimension<plane_angle_dim,-2> { }; ///> base dimension of plane angle +struct solid_angle_dim : boost::units::base_dimension<solid_angle_dim,-1> { }; ///> base dimension of solid angle } // namespace units |
|
From: Matthias S. <mat...@us...> - 2007-04-18 22:25:37
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31596/boost/units/experimental Modified Files: experimental.hpp Log Message: minor Index: experimental.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental/experimental.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- experimental.hpp 18 Apr 2007 00:20:41 -0000 1.1 +++ experimental.hpp 18 Apr 2007 22:25:37 -0000 1.2 @@ -42,36 +42,47 @@ struct nu_action_base_unit : boost::units::base_unit<action_base_dim,11> { }; struct nu_mass_base_unit : boost::units::base_unit<mass_base_dim,12> { }; -struct inch_base_unit : boost::units::base_unit<length_base_dim,13> { }; -struct pound_base_unit : boost::units::base_unit<mass_base_dim,14> { }; - struct mmHg_base_unit : boost::units::base_unit<pressure_derived_dim,13> { }; namespace cgs { -typedef make_system<centimeter_base_unit,gram_base_unit,second_base_unit>::type system; +typedef make_system<centimeter_base_unit, + gram_base_unit, + second_base_unit>::type system; -typedef unit<length_base_dim,system> length; -typedef unit<mass_base_dim,system> mass; -typedef unit<time_base_dim,system> time; +typedef unit<length_base_dim,system> length; +typedef unit<mass_base_dim,system> mass; +typedef unit<time_base_dim,system> time; + +typedef unit<velocity_derived_dim,system> velocity; +typedef unit<pressure_derived_dim,system> pressure; } // namespace cgs namespace mks { -typedef make_system<meter_base_unit,kilogram_base_unit,second_base_unit>::type system; +typedef make_system<meter_base_unit, + kilogram_base_unit, + second_base_unit>::type system; -typedef unit<length_base_dim,system> length; -typedef unit<mass_base_dim,system> mass; -typedef unit<time_base_dim,system> time; +typedef unit<length_base_dim,system> length; +typedef unit<mass_base_dim,system> mass; +typedef unit<time_base_dim,system> time; + +typedef unit<velocity_derived_dim,system> velocity; +typedef unit<pressure_derived_dim,system> pressure; } // namespace mks namespace si { -typedef make_system<meter_base_unit,kilogram_base_unit,second_base_unit, - ampere_base_unit,kelvin_base_unit,mole_base_unit, - candela_base_unit>::type system; +typedef make_system<meter_base_unit, + kilogram_base_unit, + second_base_unit, + ampere_base_unit, + kelvin_base_unit, + mole_base_unit, + candela_base_unit>::type system; typedef unit<length_base_dim,system> length; typedef unit<mass_base_dim,system> mass; @@ -90,22 +101,25 @@ typedef make_system<nu_velocity_base_unit, nu_action_base_unit, - nu_mass_base_unit>::type system; + nu_mass_base_unit>::type system; -typedef unit<velocity_base_dim,system> velocity; -typedef unit<action_base_dim,system> action; -typedef unit<mass_base_dim,system> mass; +typedef unit<velocity_base_dim,system> velocity; +typedef unit<action_base_dim,system> action; +typedef unit<mass_base_dim,system> mass; + +typedef derived_dimension<velocity_base_dim,-2, + action_base_dim,1, + mass_base_dim,-1>::type time_derived_dim; + +typedef unit<time_derived_dim,system> time; } // namespace nu namespace my_system { -typedef make_system<inch_base_unit,pound_base_unit>::type system; - -typedef unit<length_base_dim,system> length; -typedef unit<mass_base_dim,system> mass; +typedef make_system<mmHg_base_unit>::type system; -typedef unit<pressure_derived_dim,system> pressure; +typedef unit<pressure_derived_dim,system> pressure; } @@ -113,29 +127,48 @@ namespace units { -template<class Unit1,class Unit2> struct unit_converter<Unit1,Unit2>; +template<class Dim,class Sys1,class Sys2> struct base_unit_converter<Dim,Sys1,Sys2>; +// implicit base unit conversion template<> -struct unit_converter<cgs::length,si::length> : +struct base_unit_converter<time_base_dim,cgs::system,si::system> : + public trivial_conversion, + public trivial_inverse_conversion +{ + typedef time_base_dim converted_dimension_type; +}; + +// explicit base unit conversion +template<> +struct base_unit_converter<length_base_dim,cgs::system,si::system> : public trivial_inverse_conversion { - typedef double type; + typedef length_base_dim converted_dimension_type; + typedef double type; + static type value() { return(.01); } }; +// explicit derived unit conversion template<> -struct unit_converter<cgs::time,si::time> : - public trivial_conversion, +struct base_unit_converter<pressure_derived_dim,si::system,my_system::system> : public trivial_inverse_conversion -{ }; +{ + typedef pressure_derived_dim converted_dimension_type; + typedef double type; + + static type value() + { + return 760.0/1.01325e5; + } +}; +// explicit conversion between two units with different but equivalent dimensions template<> -struct unit_converter<nu::velocity,si::velocity> +struct base_unit_converter<velocity_base_dim,nu::system,si::system> { - typedef nu::velocity from_type; - typedef si::velocity to_type; - - typedef double type; + typedef velocity_derived_dim converted_dimension_type; + typedef double type; static type value() { @@ -147,3 +180,13 @@ } // namespace boost +int main() +{ + const quantity<si::pressure> p(quantity<my_system::pressure>(1.0)); + + // uses direct unit_converter + const quantity<si::velocity> v(quantity<nu::velocity>(1.0)); + const quantity<nu::velocity> v(quantity<si::velocity>(1.0)); + + return 0; +} |
|
From: Matthias S. <mat...@us...> - 2007-04-18 22:25:37
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31596/boost/units Modified Files: base_dimension.hpp Log Message: minor Index: base_dimension.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/base_dimension.hpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- base_dimension.hpp 15 Apr 2007 06:58:05 -0000 1.8 +++ base_dimension.hpp 18 Apr 2007 22:25:37 -0000 1.9 @@ -17,12 +17,15 @@ #include <boost/units/static_rational.hpp> #include <boost/units/units_fwd.hpp> -#include <boost/units/detail/base_dimension_impl.hpp> +#include <boost/units/detail/prevent_ordinal_redefinition_impl.hpp> namespace boost { namespace units { +/// INTERNAL ONLY +template<class T, long N> struct base_dimension_pair { }; + /// Defines a base dimension. To define a dimension you need to provide /// the derived class (CRTP) and a unique integer. /// struct my_dimension : boost::units::base_dimension<my_dimension, 1> {}; @@ -31,8 +34,8 @@ template<class Derived, long N, class = typename detail::ordinal_has_already_been_defined< - sizeof(boost_units_prevent_redefinition(units::long_<N>())) == sizeof(detail::yes) && - sizeof(boost_units_prevent_redefinition(units::base_dimension_pair<Derived, N>())) != sizeof(detail::yes) + sizeof(prevent_ordinal_redefinition(units::long_<N>())) == sizeof(detail::yes) && + sizeof(prevent_ordinal_redefinition(units::base_dimension_pair<Derived, N>())) != sizeof(detail::yes) >::type> class base_dimension : public mpl::long_<N> @@ -46,13 +49,13 @@ /// Register this ordinal /// INTERNAL ONLY friend detail::yes - boost_units_prevent_redefinition(const units::long_<N>&) + prevent_ordinal_redefinition(const units::long_<N>&) { return(detail::yes()); } /// But make sure we can identify the current instantiation! /// INTERNAL ONLY friend detail::yes - boost_units_prevent_redefinition(const units::base_dimension_pair<Derived, N>&) + prevent_ordinal_redefinition(const units::base_dimension_pair<Derived, N>&) { return(detail::yes()); } }; |
|
From: Matthias S. <mat...@us...> - 2007-04-18 22:24:46
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31209/libs/units/test Modified Files: test_dimensionless_quantity.cpp Log Message: narrowing conversions prohibited Index: test_dimensionless_quantity.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/test/test_dimensionless_quantity.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- test_dimensionless_quantity.cpp 3 Apr 2007 20:48:07 -0000 1.3 +++ test_dimensionless_quantity.cpp 18 Apr 2007 22:24:43 -0000 1.4 @@ -53,11 +53,13 @@ BOOST_CHECK(E6.value() == long(E_)); // implicit operator= value_type conversion - const bu::quantity<bu::dimensionless,float> E7 = E2; - BOOST_UNITS_CHECK_CLOSE(E7.value(),float(E_)); + // narrowing conversion disallowed +// const bu::quantity<bu::dimensionless,float> E7 = E2; +// BOOST_UNITS_CHECK_CLOSE(E7.value(),float(E_)); - const bu::quantity<bu::dimensionless,long> E8 = E2; - BOOST_CHECK(E8.value() == long(E_)); + // narrowing conversion disallowed +// const bu::quantity<bu::dimensionless,long> E8 = E2; +// BOOST_CHECK(E8.value() == long(E_)); // const construction bu::quantity<bu::dimensionless> E9(E2); |
|
From: Matthias S. <mat...@us...> - 2007-04-18 00:20:41
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22112/experimental Added Files: experimental.hpp Log Message: testing syntax possibilities --- NEW FILE: experimental.hpp --- #include <boost/mpl/list.hpp> #include <boost/mpl/vector.hpp> #include <boost/units/base_dimension.hpp> #include <boost/units/derived_dimension.hpp> #include <boost/units/io.hpp> #include <boost/units/ordinal.hpp> #include <boost/units/quantity.hpp> #include <boost/units/static_constant.hpp> #include <boost/units/unit.hpp> struct length_base_dim : boost::units::base_dimension<length_base_dim, 1> { }; ///> base dimension of length struct mass_base_dim : boost::units::base_dimension<mass_base_dim,2> { }; ///> base dimension of mass struct time_base_dim : boost::units::base_dimension<time_base_dim,3> { }; ///> base dimension of time struct current_base_dim : boost::units::base_dimension<current_base_dim,4> { }; ///> base dimension of current struct temperature_base_dim : boost::units::base_dimension<temperature_base_dim,5> { }; ///> base dimension of temperature struct amount_base_dim : boost::units::base_dimension<amount_base_dim,6> { }; ///> base dimension of amount struct luminous_intensity_base_dim : boost::units::base_dimension<luminous_intensity_base_dim,7> { }; ///> base dimension of luminous intensity struct charge_base_dim : boost::units::base_dimension<charge_base_dim,8> { }; ///> base dimension of charge struct velocity_base_dim : boost::units::base_dimension<velocity_base_dim,9> { }; ///> base dimension of velocity struct action_base_dim : boost::units::base_dimension<action_base_dim,10> { }; ///> base dimension of action typedef derived_dimension<length_base_dim,1,time_base_dim,-1>::type velocity_derived_dim; typedef derived_dimension<mass_base_dim,1, length_base_dim,-1, time_base_dim,-2>::type pressure_derived_dim; struct meter_base_unit : boost::units::base_unit<length_base_dim,1> { }; struct kilogram_base_unit : boost::units::base_unit<mass_base_dim,2> { }; struct second_base_unit : boost::units::base_unit<time_base_dim,3> { }; struct ampere_base_unit : boost::units::base_unit<current_base_dim,4> { }; struct kelvin_base_unit : boost::units::base_unit<temperature_base_dim,5> { }; struct mole_base_unit : boost::units::base_unit<amount_base_dim,6> { }; struct candela_base_unit : boost::units::base_unit<luminous_intensity_base_dim,7> { }; struct centimeter_base_unit : boost::units::base_unit<length_base_dim,8> { }; struct gram_base_unit : boost::units::base_unit<mass_base_dim,9> { }; struct nu_velocity_base_unit : boost::units::base_unit<velocity_base_dim,10> { }; struct nu_action_base_unit : boost::units::base_unit<action_base_dim,11> { }; struct nu_mass_base_unit : boost::units::base_unit<mass_base_dim,12> { }; struct inch_base_unit : boost::units::base_unit<length_base_dim,13> { }; struct pound_base_unit : boost::units::base_unit<mass_base_dim,14> { }; struct mmHg_base_unit : boost::units::base_unit<pressure_derived_dim,13> { }; namespace cgs { typedef make_system<centimeter_base_unit,gram_base_unit,second_base_unit>::type system; typedef unit<length_base_dim,system> length; typedef unit<mass_base_dim,system> mass; typedef unit<time_base_dim,system> time; } // namespace cgs namespace mks { typedef make_system<meter_base_unit,kilogram_base_unit,second_base_unit>::type system; typedef unit<length_base_dim,system> length; typedef unit<mass_base_dim,system> mass; typedef unit<time_base_dim,system> time; } // namespace mks namespace si { typedef make_system<meter_base_unit,kilogram_base_unit,second_base_unit, ampere_base_unit,kelvin_base_unit,mole_base_unit, candela_base_unit>::type system; typedef unit<length_base_dim,system> length; typedef unit<mass_base_dim,system> mass; typedef unit<time_base_dim,system> time; typedef unit<current_base_dim,system> current; typedef unit<temperature_base_dim,system> temperature; typedef unit<amount_base_dim,system> amount; typedef unit<luminous_intensity_base_dim,system> luminous_intensity; typedef unit<velocity_derived_dim,system> velocity; typedef unit<pressure_derived_dim,system> pressure; } // namespace si namespace nu { typedef make_system<nu_velocity_base_unit, nu_action_base_unit, nu_mass_base_unit>::type system; typedef unit<velocity_base_dim,system> velocity; typedef unit<action_base_dim,system> action; typedef unit<mass_base_dim,system> mass; } // namespace nu namespace my_system { typedef make_system<inch_base_unit,pound_base_unit>::type system; typedef unit<length_base_dim,system> length; typedef unit<mass_base_dim,system> mass; typedef unit<pressure_derived_dim,system> pressure; } namespace boost { namespace units { template<class Unit1,class Unit2> struct unit_converter<Unit1,Unit2>; template<> struct unit_converter<cgs::length,si::length> : public trivial_inverse_conversion { typedef double type; static type value() { return(.01); } }; template<> struct unit_converter<cgs::time,si::time> : public trivial_conversion, public trivial_inverse_conversion { }; template<> struct unit_converter<nu::velocity,si::velocity> { typedef nu::velocity from_type; typedef si::velocity to_type; typedef double type; static type value() { return 2.998e8; } }; } // namespace units } // namespace boost |
|
From: Matthias S. <mat...@us...> - 2007-04-18 00:13:00
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18491/experimental Added Files: base_unit.hpp fundamental_units.hpp make_system.hpp scaled_system.hpp Log Message: experimental headers for new system/unit implementation --- NEW FILE: scaled_system.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_UNITS_SCALED_SYSTEM_HPP_INCLUDED #define BOOST_UNITS_SCALED_SYSTEM_HPP_INCLUDED #include <string> #include <boost/units/io.hpp> #include <boost/units/conversion.hpp> namespace boost { namespace units { template<long Base, long Exponent> struct scale; #define BOOST_UNITS_SCALE_SPECIALIZATION(base,exponent,val,name,symbol) \ template<> \ struct scale<base, exponent> \ { \ typedef double value_type; \ static value_type value() { return(val); } \ static std::string name_prefix() { return(#name); } \ static std::string symbol_prefix() { return(#symbol); } \ } #define BOOST_UNITS_SCALE_DEF(exponent,name,symbol) \ BOOST_UNITS_SCALE_SPECIALIZATION(10,exponent,1e ## exponent, name, symbol) \ /* BOOST_UNITS_SCALE_DEF(-24, yocto, y); BOOST_UNITS_SCALE_DEF(-21, zepto, z); BOOST_UNITS_SCALE_DEF(-18, atto, a); BOOST_UNITS_SCALE_DEF(-15, femto, f); BOOST_UNITS_SCALE_DEF(-12, pico, p); BOOST_UNITS_SCALE_DEF(-9, nano, n); BOOST_UNITS_SCALE_DEF(-6, micro, u); BOOST_UNITS_SCALE_DEF(-3, milli, m); BOOST_UNITS_SCALE_DEF(-2, centi, c); BOOST_UNITS_SCALE_DEF(-1, deci, d); BOOST_UNITS_SCALE_DEF(1, deka, da); BOOST_UNITS_SCALE_DEF(2, hecto, h); BOOST_UNITS_SCALE_DEF(3, kilo, k); BOOST_UNITS_SCALE_DEF(6, mega, M); BOOST_UNITS_SCALE_DEF(9, giga, G); BOOST_UNITS_SCALE_DEF(12, tera, T); BOOST_UNITS_SCALE_DEF(15, peta, P); BOOST_UNITS_SCALE_DEF(18, exa, E); BOOST_UNITS_SCALE_DEF(21, zetta, Z); BOOST_UNITS_SCALE_DEF(24, yotta, Y); */ #undef BOOST_UNITS_SCALE_DEF #undef BOOST_UNITS_SCALE_SPECIALIZATION template<class S, class Scale> struct scaled_system { typedef S system_type; typedef Scale scale_type; }; template<class DimensionTag, class System1, class Scale, class System2> struct base_unit_converter<DimensionTag, scaled_system<System1, Scale>, System2> { typedef base_unit_converter<DimensionTag, System1, System2> base; typedef typename divide_typeof_helper<typename base::type, typename Scale::value_type>::type type; static type value() { return(base::value() / Scale::value()); } }; template<class DimensionTag, class System1, class System2, class Scale> struct base_unit_converter<DimensionTag, System1, scaled_system<System2, Scale> > { typedef base_unit_converter<DimensionTag, System1, System2> base; typedef typename multiply_typeof_helper<typename base::type, typename Scale::value_type>::type type; static type value() { return(base::value() * Scale::value()); } }; template<class DimensionTag, class System1, class Scale1, class System2, class Scale2> struct base_unit_converter<DimensionTag, scaled_system<System1, Scale1>, scaled_system<System2, Scale2> > { typedef base_unit_converter<DimensionTag, System1, System2> base; typedef typename multiply_typeof_helper< typename base::type, typename divide_typeof_helper< typename Scale2::value_type, typename Scale1::value_type >::type >::type type; static type value() { return(base::value() * (Scale2::value() / Scale1::value())); } }; template<class DimensionTag, class System, class Scale> struct base_unit_info<DimensionTag, scaled_system<System, Scale> > { typedef base_unit_info<DimensionTag, System> base; static std::string name() { return(Scale::name_prefix() + base::name()); } static std::string symbol() { return(Scale::symbol_prefix() + base::symbol()); } }; } } #endif --- NEW FILE: base_unit.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_UNITS_BASE_UNIT_HPP #define BOOST_UNITS_BASE_UNIT_HPP #include <boost/units/config.hpp> #include <boost/units/dim.hpp> #include <boost/units/dimension_list.hpp> #include <boost/units/static_rational.hpp> #include <boost/units/units_fwd.hpp> #include <boost/units/detail/prevent_ordinal_redefinition_impl.hpp> namespace boost { namespace units { /// INTERNAL ONLY template<class T, long N> struct base_unit_pair { }; /// Defines a base dimension. To define a dimension you need to provide /// the derived class (CRTP) and a unique integer. /// struct my_dimension : boost::units::base_dimension<my_dimension, 1> {}; /// It is designed so that you will get an error message if you try /// to use the same value in multiple definitions. template<class Derived, class Dim, long N, class = typename detail::ordinal_has_already_been_defined< sizeof(prevent_ordinal_redefinition(units::long_<N>())) == sizeof(detail::yes) && sizeof(prevent_ordinal_redefinition(units::base_unit_pair<Derived, N>())) != sizeof(detail::yes) >::type> class base_unit : public mpl::long_<N> { public: typedef base_unit this_type; typedef mpl::long_<N> value; typedef Dim dimension_type; private: /// Register this ordinal /// INTERNAL ONLY friend detail::yes prevent_ordinal_redefinition(const units::long_<N>&) { return(detail::yes()); } /// But make sure we can identify the current instantiation! /// INTERNAL ONLY friend detail::yes prevent_ordinal_redefinition(const units::base_unit_pair<Derived, N>&) { return(detail::yes()); } }; } // namespace units } // namespace boost #endif // BOOST_UNITS_BASE_UNIT_HPP --- NEW FILE: fundamental_units.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_UNITS_OTHER_UNITS_HPP_INCLUDED #define BOOST_UNITS_OTHER_UNITS_HPP_INCLUDED namespace boost { namespace units { struct meter_tag : public ordinal<1> {}; struct foot_tag : public ordinal<2> {}; struct inch_tag : public ordinal<3> {}; struct yard_tag : public ordinal<4> {}; struct mile_tag : public ordinal<5> {}; struct gram_tag : public ordinal<6> {}; struct slug_tag : public ordinal<7> {}; struct second_tag : public ordinal<8> {}; struct minute_tag : public ordinal<9> {}; struct hour_tag : public ordinal<10> {}; struct ampere_tag : public ordinal<11> {}; struct biot_tag : public ordinal<12> {}; struct kelvin_tag : public ordinal<13> {}; struct mole_tag : public ordinal<14> {}; struct candela_tag : public ordinal<15> {}; struct radian_tag : public ordinal<16> {}; struct degree_tag : public ordinal<17> {}; struct gradian_tag : public ordinal<18> {}; struct steradian_tag : public ordinal<19> {}; } } #endif --- NEW FILE: make_system.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_UNITS_COMPOUND_SYSTEM_HPP_INCLUDED #define BOOST_UNITS_COMPOUND_SYSTEM_HPP_INCLUDED #include <boost/mpl/size.hpp> #include <boost/mpl/begin.hpp> #include <boost/mpl/deref.hpp> #include <boost/mpl/next.hpp> #include <boost/mpl/at.hpp> #include <boost/mpl/push_front.hpp> #include <boost/units/experimental/scaled_system.hpp> #include <boost/units/system.hpp> #include <boost/units/io.hpp> #include <boost/units/conversion.hpp> #include <boost/units/dim.hpp> namespace boost { namespace units { template<class M> struct compound_system { typedef M map_type; }; template<class DimensionTag, class M, class System, class Scale> struct base_unit_converter<DimensionTag, compound_system<M>, scaled_system<System, Scale> > : base_unit_converter<DimensionTag, typename mpl::at<M, DimensionTag>::type, scaled_system<System, Scale> > {}; template<class DimensionTag, class System, class Scale, class M> struct base_unit_converter<DimensionTag, scaled_system<System, Scale>, compound_system<M> > : base_unit_converter<DimensionTag, scaled_system<System, Scale>, typename mpl::at<M, DimensionTag>::type> {}; template<class DimensionTag, class M, class System> struct base_unit_converter<DimensionTag, compound_system<M>, System> : base_unit_converter<DimensionTag, typename mpl::at<M, DimensionTag>::type, System> {}; template<class DimensionTag, class System, class M> struct base_unit_converter<DimensionTag, System, compound_system<M> > : base_unit_converter<DimensionTag, System, typename mpl::at<M, DimensionTag>::type> {}; template<class DimensionTag, class M1, class M2> struct base_unit_converter<DimensionTag, compound_system<M1>, compound_system<M2> > : base_unit_converter<DimensionTag, typename mpl::at<M1, DimensionTag>::type, typename mpl::at<M2, DimensionTag>::type> {}; template<class DimensionTag, class M> struct base_unit_info<DimensionTag, compound_system<M> > : base_unit_info<DimensionTag, typename mpl::at<M, DimensionTag>::type> {}; template<int N> struct compound_system_heterogeneous_system_view_impl { template<class Begin, class M> struct apply { typedef typename detail::get_tag<typename mpl::deref<Begin>::type>::type tag_type; typedef typename mpl::at<M,tag_type>::type at_type; typedef typename mpl::push_front<dimensionless_type,heterogeneous_system_element<at_type,typename mpl::deref<Begin>::type> >::type current; typedef typename compound_system_heterogeneous_system_view_impl<N - 1>::template apply<typename mpl::next<Begin>::type, M>::type next; typedef typename detail::merge_dimensions<current, next>::type type; }; }; template<> struct compound_system_heterogeneous_system_view_impl<0> { template<class Begin, class M> struct apply { typedef dimensionless_type type; }; }; template<class M, class Dimensions> struct heterogeneous_system_view<compound_system<M>, Dimensions> { typedef typename compound_system_heterogeneous_system_view_impl<mpl::size<Dimensions>::value>::template apply<typename mpl::begin<Dimensions>::type, M>::type type; typedef Dimensions dimension; }; template<class M> struct make_system { typedef homogeneous_system<compound_system<M> > type; }; } } #endif |
|
From: Matthias S. <mat...@us...> - 2007-04-18 00:08:52
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16739/detail Added Files: prevent_ordinal_redefinition_impl.hpp Log Message: rename base_dimension_impl.hpp -> prevent_ordinal_redefinition_impl.hpp --- NEW FILE: prevent_ordinal_redefinition_impl.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_UNITS_PREVENT_ORDINAL_REDEFINITION_IMPL_HPP #define BOOST_UNITS_PREVENT_ORDINAL_REDEFINITION_IMPL_HPP #include <boost/mpl/long.hpp> namespace boost { namespace units { namespace detail { typedef char no; struct yes { no dummy[2]; }; template<bool> struct ordinal_has_already_been_defined; template<> struct ordinal_has_already_been_defined<true> { }; template<> struct ordinal_has_already_been_defined<false> { typedef void type; }; } /// This must be in namespace boost::units so that ADL /// will work with friend functions defined inline. /// INTERNAL ONLY template<long N> struct long_ { }; /// Again this needs to be in the same namespace as long_ /// we need a mangled name because it must be found by ADL /// INTERNAL ONLY template<class T> detail::no prevent_ordinal_redefinition(const T&) { return(detail::no()); } } // namespace units } // namespace boost #endif // BOOST_UNITS_PREVENT_ORDINAL_REDEFINITION_IMPL_HPP |
|
From: Matthias S. <mat...@us...> - 2007-04-18 00:08:03
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16330/detail Removed Files: base_dimension_impl.hpp Log Message: rename base_dimension_impl.hpp -> prevent_ordinal_redefinition_impl.hpp --- base_dimension_impl.hpp DELETED --- |
|
From: Matthias S. <mat...@us...> - 2007-04-18 00:05:00
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15101/experimental Log Message: Directory /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental added to the repository |
|
From: Jan G. <jan...@us...> - 2007-04-16 23:19:16
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31610/libs/circular_buffer/doc Modified Files: circular_buffer.html circular_buffer_space_optimized.html Log Message: circular_buffer: updated srcdoc + assign bug fix Index: circular_buffer.html =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/circular_buffer.html,v retrieving revision 1.65 retrieving revision 1.66 diff -u -d -r1.65 -r1.66 --- circular_buffer.html 15 Apr 2007 22:52:33 -0000 1.65 +++ circular_buffer.html 16 Apr 2007 23:19:07 -0000 1.66 @@ -4319,7 +4319,8 @@ <b>Iterator Invalidation:</b> </dt> <dd> - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to + <a href="#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>). </dd> </dl> <dl> @@ -4359,7 +4360,7 @@ <p> The capacity of the <code>circular_buffer</code> will be set to the specified value and the content of the <code>circular_buffer</code> will be removed and replaced with copies of elements from the specified - range. (See the <i>Effect</i>.) + range. </p> <dl> <dt> @@ -4447,7 +4448,8 @@ <b>Iterator Invalidation:</b> </dt> <dd> - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to + <a href="#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>). </dd> </dl> <dl> Index: circular_buffer_space_optimized.html =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/circular_buffer_space_optimized.html,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- circular_buffer_space_optimized.html 15 Apr 2007 22:52:34 -0000 1.39 +++ circular_buffer_space_optimized.html 16 Apr 2007 23:19:07 -0000 1.40 @@ -1956,9 +1956,115 @@ <class InputIterator><br> void assign(InputIterator first, InputIterator last);</b></code><br> <br> - See the <a href="circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a> source - documentation.<br> - <br> + Assign a copy of the range into the space optimized circular buffer. + <p> + The content of the <code>circular_buffer_space_optimized</code> will be removed and replaced with copies + of elements from the specified range. + </p> + <dl> + <dt> + <b>Precondition:</b> + </dt> + <dd> + Valid range <code>[first, last)</code>.<br> + <code>first</code> and <code>last</code> have to meet the requirements of <a href= + "http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>. + </dd> + </dl> + <dl> + <dt> + <b>Effect:</b> + </dt> + <dd> + <code><a href= + "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity() + == std::distance(first, last) && <a href= + "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.min_capacity() + == 0 && <a href= + "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == + std::distance(first, last) && (*this)[0]== *first && (*this)[1] == *(first + 1) + && ... && (*this)[std::distance(first, last) - 1] == *(last - 1)</code> + </dd> + </dl> + <dl> + <dt> + <b>Parameter(s):</b> + </dt> + <dd> + <dl compact> + <dt> + <code>first</code> + </dt> + <dd> + The beginning of the range to be copied. + </dd> + </dl> + </dd> + <dd> + <dl compact> + <dt> + <code>last</code> + </dt> + <dd> + The end of the range to be copied. + </dd> + </dl> + </dd> + </dl> + <dl> + <dt> + <b>Throws:</b> + </dt> + <dd> + An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + </dd> + <dd> + Whatever <code>T::T(const T&)</code> throws. + </dd> + </dl> + <dl> + <dt> + <b>Exception Safety:</b> + </dt> + <dd> + Basic. + </dd> + </dl> + <dl> + <dt> + <b>Iterator Invalidation:</b> + </dt> + <dd> + Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except + iterators equal to <a href= + "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>). + </dd> + </dl> + <dl> + <dt> + <b>Complexity:</b> + </dt> + <dd> + Linear (in the <code>std::distance(first, last)</code>). + </dd> + </dl> + <dl> + <dt> + <b>See Also:</b> + </dt> + <dd> + <code><a href= + "#classboost_1_1circular__buffer__space__optimized_177e35432c5e69b7a16ef7d937950e7a8">operator=</a></code>, + <code><a href= + "#classboost_1_1circular__buffer__space__optimized_17ca4fda9526d0dad99706763c3b2d9f1">assign(size_type, + const_reference)</a></code>, <code><a href= + "#classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf">assign(capacity_type, + size_type, const_reference)</a></code>, <code><a href= + "#classboost_1_1circular__buffer__space__optimized_1e9347091d2d644854af0821d4b46869b">assign(capacity_type, + InputIterator, InputIterator)</a></code> + </dd> + </dl> </td> </tr> <tr> @@ -1970,9 +2076,131 @@ "#classboost_1_1circular__buffer__space__optimized_1e805212e7de49dcb60f2cad1ef304bb3">capacity_type</a> capacity_ctrl, InputIterator first, InputIterator last);</b></code><br> <br> - See the <a href="circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a> source - documentation.<br> - <br> + Assign a copy of the range into the space optimized circular buffer specifying the capacity. + <p> + The capacity of the <code>circular_buffer_space_optimized</code> will be set to the specified value and + the content of the <code>circular_buffer_space_optimized</code> will be removed and replaced with copies + of elements from the specified range. + </p> + <dl> + <dt> + <b>Precondition:</b> + </dt> + <dd> + Valid range <code>[first, last)</code>.<br> + <code>first</code> and <code>last</code> have to meet the requirements of <a href= + "http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>. + </dd> + </dl> + <dl> + <dt> + <b>Effect:</b> + </dt> + <dd> + <code><a href= + "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> == + capacity_ctrl && <a href= + "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> + <= std::distance(first, last) && (*this)[0]== *(last - capacity) && (*this)[1] == + *(last - capacity + 1) && ... && (*this)[capacity - 1] == *(last - 1)</code><br> + <br> + If the number of items to be copied from the range <code>[first, last)</code> is greater than the + specified <code>capacity</code> then only elements from the range <code>[last - capacity, last)</code> + will be copied.<br> + <br> + The amount of allocated memory will be <code>max[std::distance(first, last), + capacity_ctrl.min_capacity()]</code>. + </dd> + </dl> + <dl> + <dt> + <b>Parameter(s):</b> + </dt> + <dd> + <dl compact> + <dt> + <code>capacity_ctrl</code> + </dt> + <dd> + The new capacity controller. + </dd> + </dl> + </dd> + <dd> + <dl compact> + <dt> + <code>first</code> + </dt> + <dd> + The beginning of the range to be copied. + </dd> + </dl> + </dd> + <dd> + <dl compact> + <dt> + <code>last</code> + </dt> + <dd> + The end of the range to be copied. + </dd> + </dl> + </dd> + </dl> + <dl> + <dt> + <b>Throws:</b> + </dt> + <dd> + An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + </dd> + <dd> + Whatever <code>T::T(const T&)</code> throws. + </dd> + </dl> + <dl> + <dt> + <b>Exception Safety:</b> + </dt> + <dd> + Basic. + </dd> + </dl> + <dl> + <dt> + <b>Iterator Invalidation:</b> + </dt> + <dd> + Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except + iterators equal to <a href= + "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>). + </dd> + </dl> + <dl> + <dt> + <b>Complexity:</b> + </dt> + <dd> + Linear (in the <code>std::distance(first, last)</code>). + </dd> + </dl> + <dl> + <dt> + <b>See Also:</b> + </dt> + <dd> + <code><a href= + "#classboost_1_1circular__buffer__space__optimized_177e35432c5e69b7a16ef7d937950e7a8">operator=</a></code>, + <code><a href= + "#classboost_1_1circular__buffer__space__optimized_17ca4fda9526d0dad99706763c3b2d9f1">assign(size_type, + const_reference)</a></code>, <code><a href= + "#classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf">assign(capacity_type, + size_type, const_reference)</a></code>, <code><a href= + "#classboost_1_1circular__buffer__space__optimized_1417de2c2419c44d83a92c463762df5fb">assign(InputIterator, + InputIterator)</a></code> + </dd> + </dl> </td> </tr> <tr> |
|
From: Jan G. <jan...@us...> - 2007-04-16 23:19:16
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31610/boost/circular_buffer Modified Files: base.hpp space_optimized.hpp Log Message: circular_buffer: updated srcdoc + assign bug fix Index: space_optimized.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/space_optimized.hpp,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- space_optimized.hpp 15 Apr 2007 22:52:33 -0000 1.27 +++ space_optimized.hpp 16 Apr 2007 23:19:06 -0000 1.28 @@ -609,7 +609,34 @@ m_capacity_ctrl = capacity_ctrl; } - //! See the circular_buffer source documentation. + //! Assign a copy of the range into the space optimized circular buffer. + /*! + The content of the <code>circular_buffer_space_optimized</code> will be removed and replaced with copies of + elements from the specified range. + \pre Valid range <code>[first, last)</code>.<br> + <code>first</code> and <code>last</code> have to meet the requirements of + <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>. + \post <code>capacity().%capacity() == std::distance(first, last) \&\& capacity().min_capacity() == 0 \&\& + size() == std::distance(first, last) \&\& (*this)[0]== *first \&\& (*this)[1] == *(first + 1) \&\& ... + \&\& (*this)[std::distance(first, last) - 1] == *(last - 1)</code> + \param first The beginning of the range to be copied. + \param last The end of the range to be copied. + \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + \throws Whatever <code>T::T(const T&)</code> throws. + \par Exception Safety + Basic. + \par Iterator Invalidation + Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators + equal to end()). + \par Complexity + Linear (in the <code>std::distance(first, last)</code>). + \sa <code>operator=</code>, <code>\link assign(size_type, param_value_type) + assign(size_type, const_reference)\endlink</code>, + <code>\link assign(capacity_type, size_type, param_value_type) + assign(capacity_type, size_type, const_reference)\endlink</code>, + <code>assign(capacity_type, InputIterator, InputIterator)</code> + */ template <class InputIterator> void assign(InputIterator first, InputIterator last) { circular_buffer<T, Alloc>::assign(first, last); @@ -617,7 +644,40 @@ m_capacity_ctrl.m_min_capacity = 0; } - //! See the circular_buffer source documentation. + //! Assign a copy of the range into the space optimized circular buffer specifying the capacity. + /*! + The capacity of the <code>circular_buffer_space_optimized</code> will be set to the specified value and the + content of the <code>circular_buffer_space_optimized</code> will be removed and replaced with copies of + elements from the specified range. + \pre Valid range <code>[first, last)</code>.<br> + <code>first</code> and <code>last</code> have to meet the requirements of + <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>. + \post <code>capacity() == capacity_ctrl \&\& size() \<= std::distance(first, last) \&\& + (*this)[0]== *(last - capacity) \&\& (*this)[1] == *(last - capacity + 1) \&\& ... \&\& + (*this)[capacity - 1] == *(last - 1)</code><br><br> + If the number of items to be copied from the range <code>[first, last)</code> is greater than the + specified <code>capacity</code> then only elements from the range <code>[last - capacity, last)</code> + will be copied.<br><br> The amount of allocated memory will be + <code>max[std::distance(first, last), capacity_ctrl.min_capacity()]</code>. + \param capacity_ctrl The new capacity controller. + \param first The beginning of the range to be copied. + \param last The end of the range to be copied. + \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + \throws Whatever <code>T::T(const T&)</code> throws. + \par Exception Safety + Basic. + \par Iterator Invalidation + Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators + equal to end()). + \par Complexity + Linear (in the <code>std::distance(first, last)</code>). + \sa <code>operator=</code>, <code>\link assign(size_type, param_value_type) + assign(size_type, const_reference)\endlink</code>, + <code>\link assign(capacity_type, size_type, param_value_type) + assign(capacity_type, size_type, const_reference)\endlink</code>, + <code>assign(InputIterator, InputIterator)</code> + */ template <class InputIterator> void assign(capacity_type capacity_ctrl, InputIterator first, InputIterator last) { m_capacity_ctrl = capacity_ctrl; Index: base.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/base.hpp,v retrieving revision 1.85 retrieving revision 1.86 diff -u -d -r1.85 -r1.86 --- base.hpp 15 Apr 2007 22:52:33 -0000 1.85 +++ base.hpp 16 Apr 2007 23:19:06 -0000 1.86 @@ -1184,7 +1184,7 @@ \par Exception Safety Basic. \par Iterator Invalidation - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to end()). \par Complexity Linear (in the <code>std::distance(first, last)</code>). \sa <code>operator=</code>, <code>\link assign(size_type, param_value_type) @@ -1202,7 +1202,6 @@ /*! The capacity of the <code>circular_buffer</code> will be set to the specified value and the content of the <code>circular_buffer</code> will be removed and replaced with copies of elements from the specified range. - (See the <i>Effect</i>.) \pre Valid range <code>[first, last)</code>.<br> <code>first</code> and <code>last</code> have to meet the requirements of <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>. @@ -1221,7 +1220,7 @@ \par Exception Safety Basic. \par Iterator Invalidation - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to end()). \par Complexity Linear (in the <code>std::distance(first, last)</code>). \sa <code>operator=</code>, <code>\link assign(size_type, param_value_type) @@ -2164,7 +2163,7 @@ BOOST_CB_ASSERT(std::distance(first, last) >= 0); // check for wrong range size_type distance = std::distance(first, last); if (distance > new_capacity) { - std::advance(first, distance - capacity); + std::advance(first, distance - new_capacity); distance = new_capacity; } assign_n(new_capacity, distance, |
|
From: Jan G. <jan...@us...> - 2007-04-16 23:19:16
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31610/libs/circular_buffer/test Modified Files: base_test.cpp Log Message: circular_buffer: updated srcdoc + assign bug fix Index: base_test.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test/base_test.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- base_test.cpp 15 Apr 2007 22:52:34 -0000 1.20 +++ base_test.cpp 16 Apr 2007 23:19:07 -0000 1.21 @@ -484,6 +484,28 @@ BOOST_CHECK(!it3.is_valid(&cb11)); BOOST_CHECK(!it4.is_valid(&cb11)); + circular_buffer<MyInteger> cb12(10, 1); + it1 = cb12.end(); + it2 = cb12.begin(); + it3 = cb12.begin() + 3; + it4 = cb12.begin() + 7; + cb12.assign(cb11.begin(), cb11.end()); + BOOST_CHECK(it1.is_valid(&cb12)); + BOOST_CHECK(!it2.is_valid(&cb12)); + BOOST_CHECK(!it3.is_valid(&cb12)); + BOOST_CHECK(!it4.is_valid(&cb12)); + + circular_buffer<MyInteger> cb13(10, 1); + it1 = cb13.end(); + it2 = cb13.begin(); + it3 = cb13.begin() + 3; + it4 = cb13.begin() + 7; + cb13.assign(15, cb11.begin(), cb11.end()); + BOOST_CHECK(it1.is_valid(&cb13)); + BOOST_CHECK(!it2.is_valid(&cb13)); + BOOST_CHECK(!it3.is_valid(&cb13)); + BOOST_CHECK(!it4.is_valid(&cb13)); + #endif // #if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG) } |
|
From: Jan G. <jan...@us...> - 2007-04-15 22:52:35
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4782/libs/circular_buffer/doc Modified Files: circular_buffer.html circular_buffer_space_optimized.html Log Message: circular_buffer: updated srcdoc and test cases Index: circular_buffer.html =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/circular_buffer.html,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- circular_buffer.html 9 Apr 2007 22:06:13 -0000 1.64 +++ circular_buffer.html 15 Apr 2007 22:52:33 -0000 1.65 @@ -3131,7 +3131,8 @@ <dd> Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to <a href="#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>); does not - invalidate any iterators if the postcondition is already met prior calling this method. + invalidate any iterators if the postcondition (the <i>Effect</i>) is already met prior calling this + method. </dd> </dl> <dl> @@ -3139,7 +3140,8 @@ <b>Complexity:</b> </dt> <dd> - Linear (in the size of the <code>circular_buffer</code>); constant if the postcondition is already met. + Linear (in the size of the <code>circular_buffer</code>); constant if the postcondition (the + <i>Effect</i>) is already met. </dd> </dl> <dl> @@ -3979,7 +3981,8 @@ <b>Iterator Invalidation:</b> </dt> <dd> - Invalidates all iterators pointing to this <code>circular_buffer</code>. + Invalidates all iterators pointing to this <code>circular_buffer</code> (except iterators equal to + <a href="#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>). </dd> </dl> <dl> @@ -4081,7 +4084,8 @@ <b>Iterator Invalidation:</b> </dt> <dd> - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to + <a href="#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>). </dd> </dl> <dl> @@ -4117,7 +4121,7 @@ "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a> item);</b></code><br> <br> - Assign <code>n</code> items into the <code>circular_buffer</code> with the specified capacity. + Assign <code>n</code> items into the <code>circular_buffer</code> specifying the capacity. <p> The capacity of the <code>circular_buffer</code> will be set to the specified value and the content of the <code>circular_buffer</code> will be removed and replaced with <code>n</code> copies of the @@ -4153,7 +4157,7 @@ <code>capacity</code> </dt> <dd> - The new capacity of the <code>circular_buffer</code>. + The new capacity. </dd> </dl> </dd> @@ -4203,7 +4207,8 @@ <b>Iterator Invalidation:</b> </dt> <dd> - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to + <a href="#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>). </dd> </dl> <dl> @@ -4350,7 +4355,7 @@ "#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type</a> capacity, InputIterator first, InputIterator last);</b></code><br> <br> - Assign a copy of the range into the <code>circular_buffer</code> with the specified capacity. + Assign a copy of the range into the <code>circular_buffer</code> specifying the capacity. <p> The capacity of the <code>circular_buffer</code> will be set to the specified value and the content of the <code>circular_buffer</code> will be removed and replaced with copies of elements from the specified @@ -4392,7 +4397,7 @@ <code>capacity</code> </dt> <dd> - The new capacity of the <code>circular_buffer</code>. + The new capacity. </dd> </dl> </dd> Index: circular_buffer_space_optimized.html =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/doc/circular_buffer_space_optimized.html,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- circular_buffer_space_optimized.html 9 Apr 2007 22:06:14 -0000 1.38 +++ circular_buffer_space_optimized.html 15 Apr 2007 22:52:34 -0000 1.39 @@ -1622,8 +1622,88 @@ "classboost_1_1circular__buffer__space__optimized_177e35432c5e69b7a16ef7d937950e7a8"></a><code><b>circular_buffer_space_optimized<T,Alloc>& operator=(const circular_buffer_space_optimized<T,Alloc>& cb);</b></code><br> <br> - TODO doc.<br> - <br> + The assign operator. + <p> + Makes this <code>circular_buffer_space_optimized</code> to become a copy of the specified + <code>circular_buffer_space_optimized</code>. + </p> + <dl> + <dt> + <b>Effect:</b> + </dt> + <dd> + <code>*this == cb</code> + </dd> + </dl> + <dl> + <dt> + <b>Parameter(s):</b> + </dt> + <dd> + <dl compact> + <dt> + <code>cb</code> + </dt> + <dd> + The <code>circular_buffer_space_optimized</code> to be copied. + </dd> + </dl> + </dd> + </dl> + <dl> + <dt> + <b>Throws:</b> + </dt> + <dd> + An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + </dd> + <dd> + Whatever <code>T::T(const T&)</code> throws. + </dd> + </dl> + <dl> + <dt> + <b>Exception Safety:</b> + </dt> + <dd> + Strong. + </dd> + </dl> + <dl> + <dt> + <b>Iterator Invalidation:</b> + </dt> + <dd> + Invalidates all iterators pointing to this <code>circular_buffer_space_optimized</code> (except + iterators equal to <a href= + "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>). + </dd> + </dl> + <dl> + <dt> + <b>Complexity:</b> + </dt> + <dd> + Linear (in the size of <code>cb</code>). + </dd> + </dl> + <dl> + <dt> + <b>See Also:</b> + </dt> + <dd> + <code><a href= + "#classboost_1_1circular__buffer__space__optimized_17ca4fda9526d0dad99706763c3b2d9f1">assign(size_type, + const_reference)</a></code>, <code><a href= + "#classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf">assign(capacity_type, + size_type, const_reference)</a></code>, <code><a href= + "#classboost_1_1circular__buffer__space__optimized_1417de2c2419c44d83a92c463762df5fb">assign(InputIterator, + InputIterator)</a></code>, <code><a href= + "#classboost_1_1circular__buffer__space__optimized_1e9347091d2d644854af0821d4b46869b">assign(capacity_type, + InputIterator, InputIterator)</a></code> + </dd> + </dl> </td> </tr> <tr> @@ -1636,9 +1716,105 @@ "circular_buffer.html#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a> item);</b></code><br> <br> - See the <a href="circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a> source - documentation.<br> - <br> + Assign <code>n</code> items into the space optimized circular buffer. + <p> + The content of the <code>circular_buffer_space_optimized</code> will be removed and replaced with + <code>n</code> copies of the <code>item</code>. + </p> + <dl> + <dt> + <b>Effect:</b> + </dt> + <dd> + <code><a href= + "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity() + == n && <a href= + "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.min_capacity() + == 0 && <a href= + "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == n + && (*this)[0] == item && (*this)[1] == item && ... && (*this) [n - 1] + == item</code> + </dd> + </dl> + <dl> + <dt> + <b>Parameter(s):</b> + </dt> + <dd> + <dl compact> + <dt> + <code>n</code> + </dt> + <dd> + The number of elements the <code>circular_buffer_space_optimized</code> will be filled with. + </dd> + </dl> + </dd> + <dd> + <dl compact> + <dt> + <code>item</code> + </dt> + <dd> + The element the <code>circular_buffer_space_optimized</code> will be filled with. + </dd> + </dl> + </dd> + </dl> + <dl> + <dt> + <b>Throws:</b> + </dt> + <dd> + An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + </dd> + <dd> + Whatever <code>T::T(const T&)</code> throws. + </dd> + </dl> + <dl> + <dt> + <b>Exception Safety:</b> + </dt> + <dd> + Basic. + </dd> + </dl> + <dl> + <dt> + <b>Iterator Invalidation:</b> + </dt> + <dd> + Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except + iterators equal to <a href= + "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>). + </dd> + </dl> + <dl> + <dt> + <b>Complexity:</b> + </dt> + <dd> + Linear (in the <code>n</code>). + </dd> + </dl> + <dl> + <dt> + <b>See Also:</b> + </dt> + <dd> + <code><a href= + "#classboost_1_1circular__buffer__space__optimized_177e35432c5e69b7a16ef7d937950e7a8">operator=</a></code>, + <code><a href= + "#classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf">assign(capacity_type, + size_type, const_reference)</a></code>, <code><a href= + "#classboost_1_1circular__buffer__space__optimized_1417de2c2419c44d83a92c463762df5fb">assign(InputIterator, + InputIterator)</a></code>, <code><a href= + "#classboost_1_1circular__buffer__space__optimized_1e9347091d2d644854af0821d4b46869b">assign(capacity_type, + InputIterator, InputIterator)</a></code> + </dd> + </dl> </td> </tr> <tr> @@ -1653,9 +1829,124 @@ "circular_buffer.html#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a> item);</b></code><br> <br> - See the <a href="circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a> source - documentation.<br> - <br> + Assign <code>n</code> items into the space optimized circular buffer specifying the capacity. + <p> + The capacity of the <code>circular_buffer_space_optimized</code> will be set to the specified value and + the content of the <code>circular_buffer_space_optimized</code> will be removed and replaced with + <code>n</code> copies of the <code>item</code>. + </p> + <dl> + <dt> + <b>Precondition:</b> + </dt> + <dd> + <code>capacity_ctrl.capacity() >= n</code> + </dd> + </dl> + <dl> + <dt> + <b>Effect:</b> + </dt> + <dd> + <code><a href= + "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> == + capacity_ctrl && <a href= + "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == n + && (*this)[0] == item && (*this)[1] == item && ... && (*this) [n - 1] + == item</code><br> + <br> + The amount of allocated memory will be <code>max[n, capacity_ctrl.min_capacity()]</code>. + </dd> + </dl> + <dl> + <dt> + <b>Parameter(s):</b> + </dt> + <dd> + <dl compact> + <dt> + <code>capacity_ctrl</code> + </dt> + <dd> + The new capacity controller. + </dd> + </dl> + </dd> + <dd> + <dl compact> + <dt> + <code>n</code> + </dt> + <dd> + The number of elements the <code>circular_buffer_space_optimized</code> will be filled with. + </dd> + </dl> + </dd> + <dd> + <dl compact> + <dt> + <code>item</code> + </dt> + <dd> + The element the <code>circular_buffer_space_optimized</code> will be filled with. + </dd> + </dl> + </dd> + </dl> + <dl> + <dt> + <b>Throws:</b> + </dt> + <dd> + An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + </dd> + <dd> + Whatever <code>T::T(const T&)</code> throws. + </dd> + </dl> + <dl> + <dt> + <b>Exception Safety:</b> + </dt> + <dd> + Basic. + </dd> + </dl> + <dl> + <dt> + <b>Iterator Invalidation:</b> + </dt> + <dd> + Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except + iterators equal to <a href= + "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>). + </dd> + </dl> + <dl> + <dt> + <b>Complexity:</b> + </dt> + <dd> + Linear (in the <code>n</code>). + </dd> + </dl> + <dl> + <dt> + <b>See Also:</b> + </dt> + <dd> + <code><a href= + "#classboost_1_1circular__buffer__space__optimized_177e35432c5e69b7a16ef7d937950e7a8">operator=</a></code>, + <code><a href= + "#classboost_1_1circular__buffer__space__optimized_17ca4fda9526d0dad99706763c3b2d9f1">assign(size_type, + const_reference)</a></code>, <code><a href= + "#classboost_1_1circular__buffer__space__optimized_1417de2c2419c44d83a92c463762df5fb">assign(InputIterator, + InputIterator)</a></code>, <code><a href= + "#classboost_1_1circular__buffer__space__optimized_1e9347091d2d644854af0821d4b46869b">assign(capacity_type, + InputIterator, InputIterator)</a></code> + </dd> + </dl> </td> </tr> <tr> |
|
From: Jan G. <jan...@us...> - 2007-04-15 22:52:35
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4782/boost/circular_buffer Modified Files: base.hpp space_optimized.hpp Log Message: circular_buffer: updated srcdoc and test cases Index: space_optimized.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/space_optimized.hpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- space_optimized.hpp 9 Apr 2007 22:06:13 -0000 1.26 +++ space_optimized.hpp 15 Apr 2007 22:52:33 -0000 1.27 @@ -522,19 +522,87 @@ */ ~circular_buffer_space_optimized(); - //! TODO doc + //! The assign operator. + /*! + Makes this <code>circular_buffer_space_optimized</code> to become a copy of the specified + <code>circular_buffer_space_optimized</code>. + \post <code>*this == cb</code> + \param cb The <code>circular_buffer_space_optimized</code> to be copied. + \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + \throws Whatever <code>T::T(const T&)</code> throws. + \par Exception Safety + Strong. + \par Iterator Invalidation + Invalidates all iterators pointing to this <code>circular_buffer_space_optimized</code> (except iterators + equal to end()). + \par Complexity + Linear (in the size of <code>cb</code>). + \sa <code>\link assign(size_type, param_value_type) assign(size_type, const_reference)\endlink</code>, + <code>\link assign(capacity_type, size_type, param_value_type) + assign(capacity_type, size_type, const_reference)\endlink</code>, + <code>assign(InputIterator, InputIterator)</code>, + <code>assign(capacity_type, InputIterator, InputIterator)</code> + */ circular_buffer_space_optimized<T, Alloc>& operator = (const circular_buffer_space_optimized<T, Alloc>& cb); #endif // #if defined(BOOST_CB_NEVER_DEFINED) - //! See the circular_buffer source documentation. + //! Assign <code>n</code> items into the space optimized circular buffer. + /*! + The content of the <code>circular_buffer_space_optimized</code> will be removed and replaced with + <code>n</code> copies of the <code>item</code>. + \post <code>capacity().%capacity() == n \&\& capacity().min_capacity() == 0 \&\& size() == n \&\& (*this)[0] == + item \&\& (*this)[1] == item \&\& ... \&\& (*this) [n - 1] == item</code> + \param n The number of elements the <code>circular_buffer_space_optimized</code> will be filled with. + \param item The element the <code>circular_buffer_space_optimized</code> will be filled with. + \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + \throws Whatever <code>T::T(const T&)</code> throws. + \par Exception Safety + Basic. + \par Iterator Invalidation + Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators + equal to end()). + \par Complexity + Linear (in the <code>n</code>). + \sa <code>operator=</code>, <code>\link assign(capacity_type, size_type, param_value_type) + assign(capacity_type, size_type, const_reference)\endlink</code>, + <code>assign(InputIterator, InputIterator)</code>, + <code>assign(capacity_type, InputIterator, InputIterator)</code> + */ void assign(size_type n, param_value_type item) { circular_buffer<T, Alloc>::assign(n, item); m_capacity_ctrl.m_capacity = n; m_capacity_ctrl.m_min_capacity = 0; } - //! See the circular_buffer source documentation. + //! Assign <code>n</code> items into the space optimized circular buffer specifying the capacity. + /*! + The capacity of the <code>circular_buffer_space_optimized</code> will be set to the specified value and the + content of the <code>circular_buffer_space_optimized</code> will be removed and replaced with <code>n</code> + copies of the <code>item</code>. + \pre <code>capacity_ctrl.%capacity() >= n</code> + \post <code>capacity() == capacity_ctrl \&\& size() == n \&\& (*this)[0] == item \&\& (*this)[1] == item + \&\& ... \&\& (*this) [n - 1] == item </code><br><br> + The amount of allocated memory will be <code>max[n, capacity_ctrl.min_capacity()]</code>. + \param capacity_ctrl The new capacity controller. + \param n The number of elements the <code>circular_buffer_space_optimized</code> will be filled with. + \param item The element the <code>circular_buffer_space_optimized</code> will be filled with. + \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is + used). + \throws Whatever <code>T::T(const T&)</code> throws. + \par Exception Safety + Basic. + \par Iterator Invalidation + Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators + equal to end()). + \par Complexity + Linear (in the <code>n</code>). + \sa <code>operator=</code>, <code>\link assign(size_type, param_value_type) + assign(size_type, const_reference)\endlink</code>, <code>assign(InputIterator, InputIterator)</code>, + <code>assign(capacity_type, InputIterator, InputIterator)</code> + */ void assign(capacity_type capacity_ctrl, size_type n, param_value_type item) { BOOST_CB_ASSERT(capacity_ctrl.m_capacity >= n); // check for new capacity lower than n circular_buffer<T, Alloc>::assign(std::max(capacity_ctrl.m_min_capacity, n), n, item); Index: base.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/circular_buffer/base.hpp,v retrieving revision 1.84 retrieving revision 1.85 diff -u -d -r1.84 -r1.85 --- base.hpp 9 Apr 2007 22:06:13 -0000 1.84 +++ base.hpp 15 Apr 2007 22:52:33 -0000 1.85 @@ -608,9 +608,11 @@ Basic; no-throw if the operations in the <i>Throws</i> section do not throw anything. \par Iterator Invalidation Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to end()); - does not invalidate any iterators if the postcondition is already met prior calling this method. + does not invalidate any iterators if the postcondition (the <i>Effect</i>) is already met prior calling + this method. \par Complexity - Linear (in the size of the <code>circular_buffer</code>); constant if the postcondition is already met. + Linear (in the size of the <code>circular_buffer</code>); constant if the postcondition (the + <i>Effect</i>) is already met. \warning In general invoking any method which modifies the internal state of the <code>circular_buffer</code> may delinearize the internal buffer and invalidate the returned pointer. \sa <code>array_one()</code> and <code>array_two()</code> for the other option how to pass data into a legacy @@ -1087,7 +1089,7 @@ \par Exception Safety Strong. \par Iterator Invalidation - Invalidates all iterators pointing to this <code>circular_buffer</code>. + Invalidates all iterators pointing to this <code>circular_buffer</code> (except iterators equal to end()). \par Complexity Linear (in the size of <code>cb</code>). \sa <code>\link assign(size_type, param_value_type) assign(size_type, const_reference)\endlink</code>, @@ -1115,7 +1117,7 @@ The content of the <code>circular_buffer</code> will be removed and replaced with <code>n</code> copies of the <code>item</code>. \post <code>capacity() == n \&\& size() == n \&\& (*this)[0] == item \&\& (*this)[1] == item \&\& ... \&\& - (*this) [n - 1] == item </code> + (*this) [n - 1] == item</code> \param n The number of elements the <code>circular_buffer</code> will be filled with. \param item The element the <code>circular_buffer</code> will be filled with. \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is @@ -1124,7 +1126,7 @@ \par Exception Safety Basic. \par Iterator Invalidation - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to end()). \par Complexity Linear (in the <code>n</code>). \sa <code>operator=</code>, <code>\link assign(capacity_type, size_type, param_value_type) @@ -1136,14 +1138,14 @@ assign_n(n, n, cb_details::assign_n<param_value_type, allocator_type>(n, item, m_alloc)); } - //! Assign <code>n</code> items into the <code>circular_buffer</code> with the specified capacity. + //! Assign <code>n</code> items into the <code>circular_buffer</code> specifying the capacity. /*! The capacity of the <code>circular_buffer</code> will be set to the specified value and the content of the <code>circular_buffer</code> will be removed and replaced with <code>n</code> copies of the <code>item</code>. \pre <code>capacity >= n</code> \post <code>capacity() == capacity \&\& size() == n \&\& (*this)[0] == item \&\& (*this)[1] == item \&\& ... \&\& (*this) [n - 1] == item </code> - \param capacity The new capacity of the <code>circular_buffer</code>. + \param capacity The new capacity. \param n The number of elements the <code>circular_buffer</code> will be filled with. \param item The element the <code>circular_buffer</code> will be filled with. \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is @@ -1152,7 +1154,7 @@ \par Exception Safety Basic. \par Iterator Invalidation - Invalidates all iterators pointing to the <code>circular_buffer</code>. + Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to end()). \par Complexity Linear (in the <code>n</code>). \sa <code>operator=</code>, <code>\link assign(size_type, param_value_type) @@ -1196,7 +1198,7 @@ assign(first, last, is_integral<InputIterator>()); } - //! Assign a copy of the range into the <code>circular_buffer</code> with the specified capacity. + //! Assign a copy of the range into the <code>circular_buffer</code> specifying the capacity. /*! The capacity of the <code>circular_buffer</code> will be set to the specified value and the content of the <code>circular_buffer</code> will be removed and replaced with copies of elements from the specified range. @@ -1210,7 +1212,7 @@ If the number of items to be copied from the range <code>[first, last)</code> is greater than the specified <code>capacity</code> then only elements from the range <code>[last - capacity, last)</code> will be copied. - \param capacity The new capacity of the <code>circular_buffer</code>. + \param capacity The new capacity. \param first The beginning of the range to be copied. \param last The end of the range to be copied. \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is |
|
From: Jan G. <jan...@us...> - 2007-04-15 22:52:35
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4782/libs/circular_buffer/test Modified Files: base_test.cpp soft_iterator_invalidation.cpp space_optimized_test.cpp Log Message: circular_buffer: updated srcdoc and test cases Index: space_optimized_test.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test/space_optimized_test.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- space_optimized_test.cpp 9 Apr 2007 22:06:14 -0000 1.14 +++ space_optimized_test.cpp 15 Apr 2007 22:52:34 -0000 1.15 @@ -152,7 +152,6 @@ BOOST_CHECK(!it2.is_valid(&cb1)); BOOST_CHECK(!it3.is_valid(&cb1)); - #endif // #if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG) } Index: base_test.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test/base_test.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- base_test.cpp 8 Apr 2007 22:10:24 -0000 1.19 +++ base_test.cpp 15 Apr 2007 22:52:34 -0000 1.20 @@ -234,6 +234,17 @@ BOOST_CHECK(it5.is_valid(0)); BOOST_CHECK(it6.is_valid(0)); + circular_buffer<MyInteger> cb(10, 0); + it1 = cb.end(); + cb.clear(); + BOOST_CHECK(it1.is_valid(&cb)); + cb.push_back(1); + cb.push_back(2); + cb.push_back(3); + int i = 0; + for (it2 = cb.begin(); it2 != it1; it2++, i++); + BOOST_CHECK(i == 3); + circular_buffer<MyInteger> cb1(10, 0); circular_buffer<MyInteger> cb2(20, 0); it1 = cb1.end(); @@ -440,6 +451,39 @@ BOOST_CHECK(!it3.is_valid(&cb8)); BOOST_CHECK(it4.is_valid(&cb8)); + circular_buffer<MyInteger> cb9(15, 1); + it1 = cb9.end(); + it2 = cb9.begin(); + it3 = cb9.begin() + 6; + it4 = cb9.begin() + 12; + cb9 = cb8; + BOOST_CHECK(it1.is_valid(&cb9)); + BOOST_CHECK(!it2.is_valid(&cb9)); + BOOST_CHECK(!it3.is_valid(&cb9)); + BOOST_CHECK(!it4.is_valid(&cb9)); + + circular_buffer<MyInteger> cb10(10, 1); + it1 = cb10.end(); + it2 = cb10.begin(); + it3 = cb10.begin() + 3; + it4 = cb10.begin() + 7; + cb10.assign(5, 2); + BOOST_CHECK(it1.is_valid(&cb10)); + BOOST_CHECK(!it2.is_valid(&cb10)); + BOOST_CHECK(!it3.is_valid(&cb10)); + BOOST_CHECK(!it4.is_valid(&cb10)); + + circular_buffer<MyInteger> cb11(10, 1); + it1 = cb11.end(); + it2 = cb11.begin(); + it3 = cb11.begin() + 3; + it4 = cb11.begin() + 7; + cb11.assign(15, 5, 2); + BOOST_CHECK(it1.is_valid(&cb11)); + BOOST_CHECK(!it2.is_valid(&cb11)); + BOOST_CHECK(!it3.is_valid(&cb11)); + BOOST_CHECK(!it4.is_valid(&cb11)); + #endif // #if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG) } @@ -472,6 +516,11 @@ circular_buffer<MyInteger> cb7(8, 3); MyInteger::set_exception_trigger(3); BOOST_CHECK_THROW(cb7 = cb6, exception); + BOOST_CHECK(cb7.size() == 8); + BOOST_CHECK(cb7.capacity() == 8); + BOOST_CHECK(cb7[0] == 3); + BOOST_CHECK(cb7[7] == 3); + generic_test(cb7); circular_buffer<MyInteger> cb8(5, 10); MyInteger::set_exception_trigger(2); Index: soft_iterator_invalidation.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/circular_buffer/test/soft_iterator_invalidation.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- soft_iterator_invalidation.cpp 8 Apr 2007 22:10:24 -0000 1.4 +++ soft_iterator_invalidation.cpp 15 Apr 2007 22:52:34 -0000 1.5 @@ -1,6 +1,6 @@ // Demonstration of rules when an iterator is considered to be valid if the soft // iterator invalidation definition is applied. -// Note: The soft iterator invalidation definition can not be applied +// Note: The soft iterator invalidation definition CAN NOT be applied // to the space optimized circular buffer. // Copyright (c) 2003-2007 Jan Gaspar |
|
From: Matthias S. <mat...@us...> - 2007-04-15 07:09:09
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31090/libs/units/example Modified Files: measurement.hpp unit_example_11.cpp unit_example_17.cpp unit_example_18.cpp unit_example_2.cpp unit_example_3.cpp unit_example_4.cpp unit_example_6.cpp unit_example_7.cpp Log Message: correct example output, remove llrint/llround, add #includes to test_predicates Index: unit_example_3.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_3.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- unit_example_3.cpp 16 Mar 2007 18:29:53 -0000 1.1.1.1 +++ unit_example_3.cpp 15 Apr 2007 07:09:03 -0000 1.2 @@ -26,8 +26,8 @@ L*L = 4 m^2 L/L = 1 dimensionless L*meter = 2 m^2 -kilograms*(L/seconds)*(L/seconds) = 4 m^2 kg s^(-2) -kilograms*(L/seconds)^2 = 4 m^2 kg s^(-2) +kilograms*(L/seconds)*(L/seconds) = 4 m^2 kg s^-2 +kilograms*(L/seconds)^2 = 4 m^2 kg s^-2 L^3 = 8 m^3 L^(3/2) = 2.82843 m^(3/2) 2vL = 1.41421 m^(1/2) @@ -41,8 +41,8 @@ L*L = (-7,24) m^2 L/L = (1,0) dimensionless L*meter = (3,4) m^2 -kilograms*(L/seconds)*(L/seconds) = (-7,24) m^2 kg s^(-2) -kilograms*(L/seconds)^2 = (-7,24) m^2 kg s^(-2) +kilograms*(L/seconds)*(L/seconds) = (-7,24) m^2 kg s^-2 +kilograms*(L/seconds)^2 = (-7,24) m^2 kg s^-2 L^3 = (-117,44) m^3 L^(3/2) = (2,11) m^(3/2) 2vL = (2,1) m^(1/2) @@ -119,8 +119,8 @@ << "L*L = 4 m^2" << std::endl << "L/L = 1 dimensionless" << std::endl << "L*meter = 2 m^2" << std::endl - << "kilograms*(L/seconds)*(L/seconds) = 4 m^2 kg s^(-2)" << std::endl - << "kilograms*(L/seconds)^2 = 4 m^2 kg s^(-2)" << std::endl + << "kilograms*(L/seconds)*(L/seconds) = 4 m^2 kg s^-2" << std::endl + << "kilograms*(L/seconds)^2 = 4 m^2 kg s^-2" << std::endl << "L^3 = 8 m^3" << std::endl << "L^(3/2) = 2.82843 m^(3/2)" << std::endl << "2vL = 1.41421 m^(1/2)" << std::endl @@ -132,8 +132,8 @@ << "L*L = (-7,24) m^2" << std::endl << "L/L = (1,0) dimensionless" << std::endl << "L*meter = (3,4) m^2" << std::endl - << "kilograms*(L/seconds)*(L/seconds) = (-7,24) m^2 kg s^(-2)" << std::endl - << "kilograms*(L/seconds)^2 = (-7,24) m^2 kg s^(-2)" << std::endl + << "kilograms*(L/seconds)*(L/seconds) = (-7,24) m^2 kg s^-2" << std::endl + << "kilograms*(L/seconds)^2 = (-7,24) m^2 kg s^-2" << std::endl << "L^3 = (-117,44) m^3" << std::endl << "L^(3/2) = (2,11) m^(3/2)" << std::endl << "2vL = (2,1) m^(1/2)" << std::endl Index: unit_example_7.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_7.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- unit_example_7.cpp 5 Apr 2007 00:37:32 -0000 1.2 +++ unit_example_7.cpp 15 Apr 2007 07:09:03 -0000 1.3 @@ -374,7 +374,6 @@ std::stringstream sstream1, sstream2; double zero = 0.0, - inf = std::numeric_limits<double>::infinity(), nan = 0.0/zero; sstream1 << "Using C++ array..." << std::endl << std::endl; Index: unit_example_18.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_18.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- unit_example_18.cpp 16 Mar 2007 18:29:52 -0000 1.1.1.1 +++ unit_example_18.cpp 15 Apr 2007 07:09:03 -0000 1.2 @@ -22,13 +22,13 @@ 1.5 m 1 g 1.5 m g -1.5 m g^(-1) +1.5 m g^-1 -1 m kg s^(-2) -1 kg s^(-2) +1 m kg s^-2 +1 kg s^-2 -1 kg s^(-2) cm -1 m^(-1) kg s^(-2) cm +1 kg s^-2 cm +1 m^-1 kg s^-2 cm 0.015 m^2 @@ -80,13 +80,13 @@ sstream2 << "1.5 m" << std::endl << "1 g" << std::endl << "1.5 m g" << std::endl - << "1.5 m g^(-1)" << std::endl + << "1.5 m g^-1" << std::endl << std::endl - << "1 m kg s^(-2)" << std::endl - << "1 kg s^(-2)" << std::endl + << "1 m kg s^-2" << std::endl + << "1 kg s^-2" << std::endl << std::endl - << "1 kg s^(-2) cm" << std::endl - << "1 m^(-1) kg s^(-2) cm" << std::endl + << "1 kg s^-2 cm" << std::endl + << "1 m^-1 kg s^-2 cm" << std::endl << std::endl << "0.015 m^2" << std::endl << std::endl; Index: unit_example_2.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_2.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- unit_example_2.cpp 16 Mar 2007 18:29:53 -0000 1.1.1.1 +++ unit_example_2.cpp 15 Apr 2007 07:09:03 -0000 1.2 @@ -25,8 +25,8 @@ L-L = m L/L = dimensionless meter*meter = m^2 -M*(L/T)*(L/T) = m^2 kg s^(-2) -M*(L/T)^2 = m^2 kg s^(-2) +M*(L/T)*(L/T) = m^2 kg s^-2 +M*(L/T)^2 = m^2 kg s^-2 L^3 = m^3 L^(3/2) = m^(3/2) 2vM = kg^(1/2) @@ -74,8 +74,8 @@ << "L-L = m" << std::endl << "L/L = dimensionless" << std::endl << "meter*meter = m^2" << std::endl - << "M*(L/T)*(L/T) = m^2 kg s^(-2)" << std::endl - << "M*(L/T)^2 = m^2 kg s^(-2)" << std::endl + << "M*(L/T)*(L/T) = m^2 kg s^-2" << std::endl + << "M*(L/T)^2 = m^2 kg s^-2" << std::endl << "L^3 = m^3" << std::endl << "L^(3/2) = m^(3/2)" << std::endl << "2vM = kg^(1/2)" << std::endl Index: unit_example_6.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_6.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- unit_example_6.cpp 16 Mar 2007 18:29:53 -0000 1.1.1.1 +++ unit_example_6.cpp 15 Apr 2007 07:09:03 -0000 1.2 @@ -25,11 +25,11 @@ L+L = 8 x 10^3 m T+T = 0.2 s L*T = 400 m s -L/T = 40 x 10^3 m s^(-1) +L/T = 40 x 10^3 m s^-1 L*seconds = 4 x 10^3 m s -kilograms*(L/T)*(L/T) = 1.6 x 10^9 m^2 kg s^(-2) -kilograms*(L/T)^2 = 4 x 10^9 m^2 kg s^(-2) -(L/T)^3 = 0.4 x 10^15 m^3 s^(-3) +kilograms*(L/T)*(L/T) = 1.6 x 10^9 m^2 kg s^-2 +kilograms*(L/T)^2 = 4 x 10^9 m^2 kg s^-2 +(L/T)^3 = 0.4 x 10^15 m^3 s^-3 (L/T)^(3/2) = 0.632456 x 10^15 m^(3/2) s^(-3/2) 2v(L/T) = 63.2456 x 10^3 m^(1/2) s^(-1/2) (3/2)v(L/T) = 7.36806 x 10^9 m^(2/3) s^(-2/3) @@ -167,11 +167,11 @@ sstream2 << "L+L = 8 x 10^3 m" << std::endl; sstream2 << "T+T = 0.2 s" << std::endl; sstream2 << "L*T = 400 m s" << std::endl; - sstream2 << "L/T = 40 x 10^3 m s^(-1)" << std::endl; + sstream2 << "L/T = 40 x 10^3 m s^-1" << std::endl; sstream2 << "L*seconds = 4 x 10^3 m s" << std::endl; - sstream2 << "kilograms*(L/T)*(L/T) = 1.6 x 10^9 m^2 kg s^(-2)" << std::endl; - sstream2 << "kilograms*(L/T)^2 = 4 x 10^9 m^2 kg s^(-2)" << std::endl; - sstream2 << "(L/T)^3 = 0.4 x 10^15 m^3 s^(-3)" << std::endl; + sstream2 << "kilograms*(L/T)*(L/T) = 1.6 x 10^9 m^2 kg s^-2" << std::endl; + sstream2 << "kilograms*(L/T)^2 = 4 x 10^9 m^2 kg s^-2" << std::endl; + sstream2 << "(L/T)^3 = 0.4 x 10^15 m^3 s^-3" << std::endl; sstream2 << "(L/T)^(3/2) = 0.632456 x 10^15 m^(3/2) s^(-3/2)" << std::endl; sstream2 << "2v(L/T) = 63.2456 x 10^3 m^(1/2) s^(-1/2)" << std::endl; sstream2 << "(3/2)v(L/T) = 7.36806 x 10^9 m^(2/3) s^(-2/3)" << std::endl; Index: unit_example_4.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_4.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- unit_example_4.cpp 13 Apr 2007 01:39:22 -0000 1.10 +++ unit_example_4.cpp 15 Apr 2007 07:09:03 -0000 1.11 @@ -428,47 +428,47 @@ sstream2 << "S1 : 2" << std::endl; sstream2 << "X1 : 2" << std::endl; sstream2 << "X2 : (4/3)" << std::endl; - sstream2 << "U1 : m kg s^(-2)" << std::endl; - sstream2 << "U2 : m^2 kg s^(-2)" << std::endl; - sstream2 << "Q1 : 1 m kg s^(-2)" << std::endl; - sstream2 << "Q2 : 2 m^2 kg s^(-2)" << std::endl; + sstream2 << "U1 : m kg s^-2" << std::endl; + sstream2 << "U2 : m^2 kg s^-2" << std::endl; + sstream2 << "Q1 : 1 m kg s^-2" << std::endl; + sstream2 << "Q2 : 2 m^2 kg s^-2" << std::endl; sstream2 << std::endl; - sstream2 << "U1*S1 : 2 m kg s^(-2)" << std::endl; - sstream2 << "S1*U1 : 2 m kg s^(-2)" << std::endl; - sstream2 << "U1/S1 : 0.5 m kg s^(-2)" << std::endl; - sstream2 << "S1/U1 : 2 m^(-1) kg^(-1) s^2" << std::endl; + sstream2 << "U1*S1 : 2 m kg s^-2" << std::endl; + sstream2 << "S1*U1 : 2 m kg s^-2" << std::endl; + sstream2 << "U1/S1 : 0.5 m kg s^-2" << std::endl; + sstream2 << "S1/U1 : 2 m^-1 kg^-1 s^2" << std::endl; sstream2 << std::endl; - sstream2 << "U1+U1 : m kg s^(-2)" << std::endl; - sstream2 << "U1-U1 : m kg s^(-2)" << std::endl; - sstream2 << "U1*U1 : m^2 kg^2 s^(-4)" << std::endl; + sstream2 << "U1+U1 : m kg s^-2" << std::endl; + sstream2 << "U1-U1 : m kg s^-2" << std::endl; + sstream2 << "U1*U1 : m^2 kg^2 s^-4" << std::endl; sstream2 << "U1/U1 : dimensionless" << std::endl; - sstream2 << "U1*U2 : m^3 kg^2 s^(-4)" << std::endl; - sstream2 << "U1/U2 : m^(-1)" << std::endl; - sstream2 << "U1^X : m^2 kg^2 s^(-4)" << std::endl; - sstream2 << "X1vU1 : m^(1/2) kg^(1/2) s^(-1)" << std::endl; + sstream2 << "U1*U2 : m^3 kg^2 s^-4" << std::endl; + sstream2 << "U1/U2 : m^-1" << std::endl; + sstream2 << "U1^X : m^2 kg^2 s^-4" << std::endl; + sstream2 << "X1vU1 : m^(1/2) kg^(1/2) s^-1" << std::endl; sstream2 << "U1^X2 : m^(4/3) kg^(4/3) s^(-8/3)" << std::endl; sstream2 << "X2vU1 : m^(3/4) kg^(3/4) s^(-3/2)" << std::endl; sstream2 << std::endl; - sstream2 << "Q1*S1 : 2 m kg s^(-2)" << std::endl; - sstream2 << "S1*Q1 : 2 m kg s^(-2)" << std::endl; - sstream2 << "Q1/S1 : 0.5 m kg s^(-2)" << std::endl; - sstream2 << "S1/Q1 : 2 m^(-1) kg^(-1) s^2" << std::endl; + sstream2 << "Q1*S1 : 2 m kg s^-2" << std::endl; + sstream2 << "S1*Q1 : 2 m kg s^-2" << std::endl; + sstream2 << "Q1/S1 : 0.5 m kg s^-2" << std::endl; + sstream2 << "S1/Q1 : 2 m^-1 kg^-1 s^2" << std::endl; sstream2 << std::endl; - sstream2 << "U1*Q1 : 1 m^2 kg^2 s^(-4)" << std::endl; - sstream2 << "Q1*U1 : 1 m^2 kg^2 s^(-4)" << std::endl; + sstream2 << "U1*Q1 : 1 m^2 kg^2 s^-4" << std::endl; + sstream2 << "Q1*U1 : 1 m^2 kg^2 s^-4" << std::endl; sstream2 << "U1/Q1 : 1 dimensionless" << std::endl; sstream2 << "Q1/U1 : 1 dimensionless" << std::endl; sstream2 << std::endl; - sstream2 << "+Q1 : 1 m kg s^(-2)" << std::endl; - sstream2 << "-Q1 : -1 m kg s^(-2)" << std::endl; - sstream2 << "Q1+Q1 : 2 m kg s^(-2)" << std::endl; - sstream2 << "Q1-Q1 : 0 m kg s^(-2)" << std::endl; - sstream2 << "Q1*Q1 : 1 m^2 kg^2 s^(-4)" << std::endl; + sstream2 << "+Q1 : 1 m kg s^-2" << std::endl; + sstream2 << "-Q1 : -1 m kg s^-2" << std::endl; + sstream2 << "Q1+Q1 : 2 m kg s^-2" << std::endl; + sstream2 << "Q1-Q1 : 0 m kg s^-2" << std::endl; + sstream2 << "Q1*Q1 : 1 m^2 kg^2 s^-4" << std::endl; sstream2 << "Q1/Q1 : 1 dimensionless" << std::endl; - sstream2 << "Q1*Q2 : 2 m^3 kg^2 s^(-4)" << std::endl; - sstream2 << "Q1/Q2 : 0.5 m^(-1)" << std::endl; - sstream2 << "Q1^X1 : 1 m^2 kg^2 s^(-4)" << std::endl; - sstream2 << "X1vQ1 : 1 m^(1/2) kg^(1/2) s^(-1)" << std::endl; + sstream2 << "Q1*Q2 : 2 m^3 kg^2 s^-4" << std::endl; + sstream2 << "Q1/Q2 : 0.5 m^-1" << std::endl; + sstream2 << "Q1^X1 : 1 m^2 kg^2 s^-4" << std::endl; + sstream2 << "X1vQ1 : 1 m^(1/2) kg^(1/2) s^-1" << std::endl; sstream2 << "Q1^X2 : 1 m^(4/3) kg^(4/3) s^(-8/3)" << std::endl; sstream2 << "X2vQ1 : 1 m^(3/4) kg^(3/4) s^(-3/2)" << std::endl; sstream2 << std::endl; @@ -481,19 +481,19 @@ sstream2 << std::endl; sstream2 << "dimless = 1" << std::endl; sstream2 << std::endl; - sstream2 << "v1 = 2 m s^(-1)" << std::endl; + sstream2 << "v1 = 2 m s^-1" << std::endl; sstream2 << std::endl; - sstream2 << "F = 1 m kg s^(-2)" << std::endl; + sstream2 << "F = 1 m kg s^-2" << std::endl; sstream2 << "dx = 1 m" << std::endl; - sstream2 << "E = 1 m^2 kg s^(-2)" << std::endl; + sstream2 << "E = 1 m^2 kg s^-2" << std::endl; sstream2 << std::endl; sstream2 << "r = " << 5e-7 << " m" << std::endl; - sstream2 << "P = 101325 m^(-1) kg s^(-2)" << std::endl; + sstream2 << "P = 101325 m^-1 kg s^-2" << std::endl; sstream2 << "V = " << 5.23599e-19 << " m^3" << std::endl; sstream2 << "T = 310 K" << std::endl; sstream2 << "n = " << 2.05835e-17 << " mol" << std::endl; #if BOOST_UNITS_HAS_TYPEOF - sstream2 << "R = 8.314472 (rel. unc. = " << 1.8e-6 << ") m^2 kg s^(-2) K^(-1) mol^(-1)" << std::endl; + sstream2 << "R = 8.314472 (rel. unc. = " << 1.8e-6 << ") m^2 kg s^-2 K^-1 mol^-1" << std::endl; #else sstream2 << "no typeof" << std::endl; #endif // BOOST_UNITS_HAS_TYPEOF @@ -502,17 +502,17 @@ sstream2 << "sin(theta) = " << 0.366273 << " dimensionless" << std::endl; sstream2 << "asin(sin(theta)) = " << 0.375 << " rad" << std::endl; sstream2 << std::endl; - sstream2 << "V = (12.5,0) m^2 kg s^(-3) A^(-1)" << std::endl; + sstream2 << "V = (12.5,0) m^2 kg s^-3 A^-1" << std::endl; sstream2 << "I = (3,4) A" << std::endl; - sstream2 << "Z = (1.5,-2) m^2 kg s^(-3) A^(-2)" << std::endl; - sstream2 << "I*Z = (12.5,0) m^2 kg s^(-3) A^(-1)" << std::endl; + sstream2 << "Z = (1.5,-2) m^2 kg s^-3 A^-2" << std::endl; + sstream2 << "I*Z = (12.5,0) m^2 kg s^-3 A^-1" << std::endl; sstream2 << std::endl; sstream2 << std::scientific << std::setprecision(1); - sstream2 << "x+y-w = 0.48 (rel. unc. = " << 1.3 << ") m" << std::endl; - sstream2 << "w*x = 9.04 (rel. unc. = " << 1.0e-1 << ") m^2" << std::endl; - sstream2 << "x/y = 0.6667 (rel. unc. = " << 2.2e-1 << ") dimensionless" << std::endl; - sstream2 << "w*y^2/(u*x)^2 = 10.17 (rel. unc. = " << 3.5e-1 << ") m^(-1)" << std::endl; - sstream2 << "w/(u*x)^(1/2) = 3.1961 (rel. unc. = " << 5.0e-2 << ") dimensionless" << std::endl; + sstream2 << "x+y-w = 0.48(+/-0.632772) m" << std::endl; + sstream2 << "w*x = 9.04(+/-0.904885) m^2" << std::endl; + sstream2 << "x/y = 0.666667(+/-0.149071) dimensionless" << std::endl; + sstream2 << "w*y^2/(u*x)^2 = 10.17(+/-3.52328) m^-1" << std::endl; + sstream2 << "w/(u*x)^(1/2) = 3.19612(+/-0.160431) dimensionless" << std::endl; sstream2 << std::endl; std::string str1(sstream1.str()); Index: unit_example_11.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_11.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- unit_example_11.cpp 5 Apr 2007 00:35:47 -0000 1.2 +++ unit_example_11.cpp 15 Apr 2007 07:09:03 -0000 1.3 @@ -46,8 +46,6 @@ fma(q1,q2,q3) : 16.25 m^2 fpclassify(q1) : 4 hypot(q1,q2) : 2.91548 m -llrint(q1) : 2 m -llround(q1) : 2 m nearbyint(q1) : 2 m nextafter(q1,q2) : 1.5 m nexttoward(q1,q2) : 1.5 m @@ -111,8 +109,6 @@ << "fma(q1,q2,q3) : " << fma BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2,q3) << std::endl << "fpclassify(q1) : " << fpclassify BOOST_PREVENT_MACRO_SUBSTITUTION (q1) << std::endl << "hypot(q1,q2) : " << hypot BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2) << std::endl - << "llrint(q1) : " << llrint BOOST_PREVENT_MACRO_SUBSTITUTION (q1) << std::endl - << "llround(q1) : " << llround BOOST_PREVENT_MACRO_SUBSTITUTION (q1) << std::endl << "nearbyint(q1) : " << nearbyint BOOST_PREVENT_MACRO_SUBSTITUTION (q1) << std::endl << "nextafter(q1,q2) : " << nextafter BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2) << std::endl << "nexttoward(q1,q2) : " << nexttoward BOOST_PREVENT_MACRO_SUBSTITUTION (q1,q2) << std::endl @@ -148,8 +144,6 @@ sstream2 << "fma(q1,q2,q3) : 16.25 m^2" << std::endl; sstream2 << "fpclassify(q1) : "<< fpclassify BOOST_PREVENT_MACRO_SUBSTITUTION (q1) << std::endl; sstream2 << "hypot(q1,q2) : 2.91548 m" << std::endl; - sstream2 << "llrint(q1) : 2 m" << std::endl; - sstream2 << "llround(q1) : 2 m" << std::endl; sstream2 << "nearbyint(q1) : 2 m" << std::endl; sstream2 << "nextafter(q1,q2) : 1.5 m" << std::endl; sstream2 << "nexttoward(q1,q2) : 1.5 m" << std::endl; Index: measurement.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/measurement.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- measurement.hpp 13 Apr 2007 01:38:40 -0000 1.4 +++ measurement.hpp 15 Apr 2007 07:09:03 -0000 1.5 @@ -17,7 +17,7 @@ #include <iostream> #include <boost/io/ios_state.hpp> -#include <boost/numeric/interval.hpp> +//#include <boost/numeric/interval.hpp> #include <boost/units/static_rational.hpp> namespace boost { @@ -40,7 +40,7 @@ public: typedef measurement<Y> this_type; typedef Y value_type; - typedef numeric::interval<value_type> interval_type; +// typedef numeric::interval<value_type> interval_type; measurement(const value_type& val = value_type(), const value_type& err = value_type()) : @@ -72,7 +72,7 @@ value_type lower_bound() const { return value_-uncertainty_; } value_type upper_bound() const { return value_+uncertainty_; } - interval_type get_interval() const { return interval_type(lower_bound(),upper_bound()); } +// interval_type get_interval() const { return interval_type(lower_bound(),upper_bound()); } this_type& operator+=(const value_type& val) { @@ -318,30 +318,32 @@ //os << std::setw(21); - if (val.uncertainty() > Y(0)) - { - const Y relative_uncertainty = std::abs(val.uncertainty()/val.value()); +// if (val.uncertainty() > Y(0)) +// { +// const Y relative_uncertainty = std::abs(val.uncertainty()/val.value()); +// +// const double exponent = std::log10(relative_uncertainty); +// const long digits_of_precision = static_cast<long>(std::ceil(std::abs(exponent)))+3; +// +// // should try to replicate NIST CODATA syntax +// os << std::setprecision(digits_of_precision) +// //<< std::setw(digits_of_precision+8) +// //<< std::scientific +// << val.value(); +//// << long(10*(relative_uncertainty/std::pow(Y(10),Y(exponent)))); +// +// os << " (rel. unc. = " +// << std::setprecision(1) +// //<< std::setw(7) +// << std::scientific +// << relative_uncertainty << ")"; +// } +// else +// { +// os << val.value() << " (exact)"; +// } - const double exponent = std::log10(relative_uncertainty); - const long digits_of_precision = static_cast<long>(std::ceil(std::abs(exponent)))+3; - - // should try to replicate NIST CODATA syntax - os << std::setprecision(digits_of_precision) - //<< std::setw(digits_of_precision+8) - //<< std::scientific - << val.value(); -// << long(10*(relative_uncertainty/std::pow(Y(10),Y(exponent)))); - - os << " (rel. unc. = " - << std::setprecision(1) - //<< std::setw(7) - << std::scientific - << relative_uncertainty << ")"; - } - else - { - os << val.value() << " (exact)"; - } + os << val.value() << "(+/-" << val.uncertainty() << ")"; return os; } Index: unit_example_17.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_17.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- unit_example_17.cpp 16 Mar 2007 18:29:52 -0000 1.1.1.1 +++ unit_example_17.cpp 15 Apr 2007 07:09:03 -0000 1.2 @@ -24,8 +24,8 @@ L+L = [L] L-L = [L] L/L = dimensionless -M*(L/T)*(L/T) = [L]^2 [M] [T]^(-2) -M*(L/T)^2 = [L]^2 [M] [T]^(-2) +M*(L/T)*(L/T) = [L]^2 [M] [T]^-2 +M*(L/T)^2 = [L]^2 [M] [T]^-2 L^3 = [L]^3 L^(3/2) = [L]^(3/2) 2vM = [M]^(1/2) @@ -70,8 +70,8 @@ sstream2 << "L+L = [L]" << std::endl; sstream2 << "L-L = [L]" << std::endl; sstream2 << "L/L = dimensionless" << std::endl; - sstream2 << "M*(L/T)*(L/T) = [L]^2 [M] [T]^(-2)" << std::endl; - sstream2 << "M*(L/T)^2 = [L]^2 [M] [T]^(-2)" << std::endl; + sstream2 << "M*(L/T)*(L/T) = [L]^2 [M] [T]^-2" << std::endl; + sstream2 << "M*(L/T)^2 = [L]^2 [M] [T]^-2" << std::endl; sstream2 << "L^3 = [L]^3" << std::endl; sstream2 << "L^(3/2) = [L]^(3/2)" << std::endl; sstream2 << "2vM = [M]^(1/2)" << std::endl; |
|
From: Matthias S. <mat...@us...> - 2007-04-15 07:09:08
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31090/libs/units/test Modified Files: test_cmath.cpp test_header.hpp test_predicates.cpp Log Message: correct example output, remove llrint/llround, add #includes to test_predicates Index: test_header.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/test/test_header.hpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- test_header.hpp 14 Apr 2007 21:52:00 -0000 1.7 +++ test_header.hpp 15 Apr 2007 07:09:03 -0000 1.8 @@ -39,9 +39,9 @@ namespace units { -struct length_dim : boost::units::base_dimension<length_dim, 1> {}; ///> base dimension of length -struct mass_dim : boost::units::base_dimension<mass_dim,2> {}; ///> base dimension of mass -struct time_dim : boost::units::base_dimension<time_dim,3> {}; ///> base dimension of time +struct length_dim : boost::units::base_dimension<length_dim,1> { }; ///> base dimension of length +struct mass_dim : boost::units::base_dimension<mass_dim,2> { }; ///> base dimension of mass +struct time_dim : boost::units::base_dimension<time_dim,3> { }; ///> base dimension of time typedef length_dim::type length_type; typedef mass_dim::type mass_type; Index: test_cmath.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/test/test_cmath.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- test_cmath.cpp 16 Mar 2007 18:29:54 -0000 1.1.1.1 +++ test_cmath.cpp 15 Apr 2007 07:09:03 -0000 1.2 @@ -118,8 +118,8 @@ BOOST_CHECK(bu::hypot(L1,L2) == 5.0*bu::meters); - BOOST_CHECK(bu::llrint(E4).value() == bu::detail::llrint(E4.value())); - BOOST_CHECK(bu::llround(E4).value() == bu::detail::llround(E4.value())); +// BOOST_CHECK(bu::llrint(E4).value() == bu::detail::llrint(E4.value())); +// BOOST_CHECK(bu::llround(E4).value() == bu::detail::llround(E4.value())); BOOST_CHECK(bu::nearbyint(E4).value() == bu::detail::nearbyint(E4.value())); BOOST_CHECK(bu::rint(E4).value() == bu::detail::rint(E4.value())); Index: test_predicates.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/test/test_predicates.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- test_predicates.cpp 12 Apr 2007 20:42:29 -0000 1.4 +++ test_predicates.cpp 15 Apr 2007 07:09:03 -0000 1.5 @@ -24,13 +24,22 @@ #include <boost/mpl/assert.hpp> #include <boost/mpl/list/list0.hpp> +#include <boost/units/base_dimension.hpp> #include <boost/units/dimension.hpp> +#include <boost/units/is_dimension_list.hpp> +#include <boost/units/is_quantity.hpp> +#include <boost/units/is_quantity_of_dimension.hpp> +#include <boost/units/is_quantity_of_system.hpp> +#include <boost/units/is_unit.hpp> +#include <boost/units/is_unit_of_dimension.hpp> +#include <boost/units/is_unit_of_system.hpp> +#include <boost/units/ordinal.hpp> #include <boost/units/quantity.hpp> #include <boost/units/unit.hpp> namespace bu = boost::units; -BOOST_UNITS_REGISTER_BASE_DIMENSION(dimension_tag, 0); +struct dimension_tag : boost::units::base_dimension<dimension_tag,0> { }; struct system1 : bu::ordinal<100> {}; struct system2 : bu::ordinal<101> {}; |
|
From: Matthias S. <mat...@us...> - 2007-04-15 07:07:19
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30317/boost/units/detail Modified Files: conversion_impl.hpp Log Message: eliminate g++ warnings Index: conversion_impl.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail/conversion_impl.hpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- conversion_impl.hpp 12 Apr 2007 18:08:35 -0000 1.7 +++ conversion_impl.hpp 15 Apr 2007 07:07:15 -0000 1.8 @@ -225,7 +225,7 @@ Y static_rational_power(const Y& y) { return(detail::static_rational_power_impl<R, Y>::apply(y)); -}; +} // convert between homogeneous systems template<int N> |
|
From: Matthias S. <mat...@us...> - 2007-04-15 07:07:19
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30317/boost/units Modified Files: conversion.hpp dimension.hpp Log Message: eliminate g++ warnings Index: dimension.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/dimension.hpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- dimension.hpp 13 Apr 2007 06:08:52 -0000 1.9 +++ dimension.hpp 15 Apr 2007 07:07:15 -0000 1.10 @@ -34,14 +34,6 @@ namespace boost { namespace units { -// -///// Dimension lists in which all exponents resolve to zero reduce to @c dimensionless_type. -//struct dimensionless_type -//{ -// typedef dimensionless_type type; -// typedef detail::dimension_list_tag tag; -// typedef mpl::long_<0> size; -//}; /// Reduce dimension list to cardinal form. This algorithm collapses duplicate unit /// tags, strips dimensionless tags, and sorts the resulting list. Sorting of homogeneous @@ -58,22 +50,6 @@ typedef typename detail::sort_dims_to_mpl_list<type2>::type type; }; -// -///// Check that a type is a valid dimension list. -//template<typename Seq> -//struct is_dimension_list : -// public mpl::false_ -//{ }; -// -//template<typename Item, typename Next> -//struct is_dimension_list<dimension_list<Item, Next> > : -// public mpl::true_ -//{ }; -// -//template<> -//struct is_dimension_list<dimensionless_type> : -// public mpl::true_ -//{ }; /// Raise a dimension list to a scalar power. template<typename DL,typename Ex> @@ -114,60 +90,6 @@ static_rational<N,D> >::type type; }; -// -///// A utility class for defining base dimensions. -//template<long N> struct base_dimension; -// -///// each specialization must be separately instantiated in boost::units namespace to prevent duplication of tag values -//#define BOOST_UNITS_REGISTER_BASE_DIMENSION(name, N) \ -//template<> \ -//struct base_dimension<N> : \ -// public mpl::int_<N> \ -//{ \ -// typedef base_dimension<N> this_type; \ -// typedef mpl::int_<N> value; \ -// \ -// typedef make_dimension_list< mpl::list< dim< this_type,static_rational<1> > > >::type type; \ -//}; \ -// \ -//typedef base_dimension<N> name \ - -//// gcc doesn't like this for some reason... -///// each specialization must be separately instantiated in boost::units namespace to prevent duplication of tag values -//#define BOOST_UNITS_REGISTER_BASE_DIMENSION(name, N) \ -//template<> \ -//struct boost::units::base_dimension<N> : \ -// public boost::mpl::int_<N> \ -//{ \ -// typedef boost::units::base_dimension<N> this_type; \ -// typedef boost::mpl::int_<N> value; \ -// \ -// typedef boost::units::make_dimension_list< boost::mpl::list< boost::units::dim< this_type,boost::units::static_rational<1> > > >::type type;\ -//}; \ -// \ -//typedef boost::units::base_dimension<N> name \ -// -///// A utility class for defining composite dimensions with integer powers. -//template<class DT1 = dimensionless_type,int E1 = 0, -// class DT2 = dimensionless_type,int E2 = 0, -// class DT3 = dimensionless_type,int E3 = 0, -// class DT4 = dimensionless_type,int E4 = 0, -// class DT5 = dimensionless_type,int E5 = 0, -// class DT6 = dimensionless_type,int E6 = 0, -// class DT7 = dimensionless_type,int E7 = 0, -// class DT8 = dimensionless_type,int E8 = 0> -//struct derived_dimension -//{ -// typedef typename -// make_dimension_list< mpl::list< dim< DT1,static_rational<E1> >, -// dim< DT2,static_rational<E2> >, -// dim< DT3,static_rational<E3> >, -// dim< DT4,static_rational<E4> >, -// dim< DT5,static_rational<E5> >, -// dim< DT6,static_rational<E6> >, -// dim< DT7,static_rational<E7> >, -// dim< DT8,static_rational<E8> > > >::type type; -//}; } // namespace units Index: conversion.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/conversion.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- conversion.hpp 5 Apr 2007 22:42:01 -0000 1.5 +++ conversion.hpp 15 Apr 2007 07:07:15 -0000 1.6 @@ -151,7 +151,7 @@ { // dangerous if conversion is not regular...don't know how to deal with this yet return quantity<ToUnit,Y>(Y(1)*FromUnit()).value(); -}; +} } // namespace units |
|
From: Matthias S. <mat...@us...> - 2007-04-15 07:06:44
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30299/boost/units/detail Modified Files: cmath_gnu_impl.hpp cmath_msvc_impl.hpp cmath_mwcw_impl.hpp Log Message: comment out llrint llround - not ISO C++ Index: cmath_gnu_impl.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail/cmath_gnu_impl.hpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- cmath_gnu_impl.hpp 16 Mar 2007 18:12:43 -0000 1.1.1.1 +++ cmath_gnu_impl.hpp 15 Apr 2007 07:06:43 -0000 1.2 @@ -147,17 +147,17 @@ return __builtin_hypot(v1,v2); } -template<class Y> -inline long long llrint(const Y& val) -{ - return __builtin_llrint(val); -} - -template<class Y> -inline long long llround(const Y& val) -{ - return __builtin_llround(val); -} +//template<class Y> +//inline long long llrint(const Y& val) +//{ +// return __builtin_llrint(val); +//} +// +//template<class Y> +//inline long long llround(const Y& val) +//{ +// return __builtin_llround(val); +//} template<class Y> inline Y nearbyint(const Y& val) Index: cmath_mwcw_impl.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail/cmath_mwcw_impl.hpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- cmath_mwcw_impl.hpp 16 Mar 2007 18:12:43 -0000 1.1.1.1 +++ cmath_mwcw_impl.hpp 15 Apr 2007 07:06:43 -0000 1.2 @@ -153,17 +153,17 @@ return std::hypot(v1,v2); } -template<class Y> -inline long long llrint BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val) -{ - return std::llrint(val); -} - -template<class Y> -inline long long llround BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val) -{ - return std::llround(val); -} +//template<class Y> +//inline long long llrint BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val) +//{ +// return std::llrint(val); +//} +// +//template<class Y> +//inline long long llround BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val) +//{ +// return std::llround(val); +//} template<class Y> inline Y nearbyint BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val) Index: cmath_msvc_impl.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail/cmath_msvc_impl.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- cmath_msvc_impl.hpp 5 Apr 2007 00:05:59 -0000 1.2 +++ cmath_msvc_impl.hpp 15 Apr 2007 07:06:43 -0000 1.3 @@ -235,17 +235,17 @@ return hypotf_impl::do_hypot(v1,v2,condition); } -template<class Y> -inline long long llrint(const Y& val) -{ - return static_cast<long long>(rint(val)); -} - -template<class Y> -inline long long llround(const Y& val) -{ - return static_cast<long long>(round(val)); -} +//template<class Y> +//inline long long llrint(const Y& val) +//{ +// return static_cast<long long>(rint(val)); +//} +// +//template<class Y> +//inline long long llround(const Y& val) +//{ +// return static_cast<long long>(round(val)); +//} template<class Y> inline Y nearbyint(const Y& val) |
|
From: Matthias S. <mat...@us...> - 2007-04-15 07:06:04
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29911/boost/units Modified Files: cmath.hpp Log Message: comment out llrint llround - not ISO C++ Index: cmath.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/cmath.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- cmath.hpp 29 Mar 2007 19:02:29 -0000 1.3 +++ cmath.hpp 15 Apr 2007 07:06:03 -0000 1.4 @@ -282,29 +282,31 @@ return quantity_type::from_value(hypot BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value())); } -template<class Unit,class Y> -inline -quantity<Unit,long long> -llrint BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q) -{ - using namespace detail; - - typedef quantity<Unit,long long> quantity_type; - - return quantity_type::from_value(llrint BOOST_PREVENT_MACRO_SUBSTITUTION (q.value())); -} - -template<class Unit,class Y> -inline -quantity<Unit,long long> -llround BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q) -{ - using namespace detail; +// does ISO C++ support long long? g++ claims not +//template<class Unit,class Y> +//inline +//quantity<Unit,long long> +//llrint BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q) +//{ +// using namespace detail; +// +// typedef quantity<Unit,long long> quantity_type; +// +// return quantity_type::from_value(llrint BOOST_PREVENT_MACRO_SUBSTITUTION (q.value())); +//} - typedef quantity<Unit,long long> quantity_type; - - return quantity_type::from_value(llround BOOST_PREVENT_MACRO_SUBSTITUTION (q.value())); -} +// does ISO C++ support long long? g++ claims not +//template<class Unit,class Y> +//inline +//quantity<Unit,long long> +//llround BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q) +//{ +// using namespace detail; +// +// typedef quantity<Unit,long long> quantity_type; +// +// return quantity_type::from_value(llround BOOST_PREVENT_MACRO_SUBSTITUTION (q.value())); +//} template<class Unit,class Y> inline |
|
From: Matthias S. <mat...@us...> - 2007-04-15 06:58:07
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26569/boost/units Modified Files: base_dimension.hpp Log Message: move implementation to separate header Index: base_dimension.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/base_dimension.hpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- base_dimension.hpp 15 Apr 2007 06:51:00 -0000 1.7 +++ base_dimension.hpp 15 Apr 2007 06:58:05 -0000 1.8 @@ -11,50 +11,18 @@ #ifndef BOOST_UNITS_BASE_DIMENSION_HPP #define BOOST_UNITS_BASE_DIMENSION_HPP -#include <boost/mpl/long.hpp> - #include <boost/units/config.hpp> -#include <boost/units/static_rational.hpp> #include <boost/units/dim.hpp> #include <boost/units/dimension_list.hpp> +#include <boost/units/static_rational.hpp> #include <boost/units/units_fwd.hpp> +#include <boost/units/detail/base_dimension_impl.hpp> + namespace boost { namespace units { -namespace detail { - -typedef char no; -struct yes { no dummy[2]; }; - -template<bool> struct ordinal_has_already_been_defined; - -template<> -struct ordinal_has_already_been_defined<true> { }; - -template<> -struct ordinal_has_already_been_defined<false> { typedef void type; }; - -} - -/// This must be in namespace boost::units so that ADL -/// will work with friend functions defined inline. -/// INTERNAL ONLY -template<long N> struct long_ { }; - -/// Again this needs to be in the same namespace as long_ -/// we need a mangled name because it must be found by ADL -/// INTERNAL ONLY -template<class T> -detail::no -boost_units_prevent_redefinition(const T&) -{ return(detail::no()); } - -/// Ditto. -/// INTERNAL ONLY -template<class T, long N> struct base_dimension_pair { }; - /// Defines a base dimension. To define a dimension you need to provide /// the derived class (CRTP) and a unique integer. /// struct my_dimension : boost::units::base_dimension<my_dimension, 1> {}; @@ -70,9 +38,9 @@ public mpl::long_<N> { public: - typedef base_dimension this_type; - typedef mpl::long_<N> value; - typedef dimension_list<dim<Derived,static_rational<1> >, dimensionless_type> type; + typedef base_dimension this_type; + typedef mpl::long_<N> value; + typedef dimension_list<dim<Derived,static_rational<1> >, dimensionless_type> type; private: /// Register this ordinal |
|
From: Matthias S. <mat...@us...> - 2007-04-15 06:57:40
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/detail In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26552/boost/units/detail Added Files: base_dimension_impl.hpp Log Message: base_dimension implementation header --- NEW FILE: base_dimension_impl.hpp --- // mcs::units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2007 Matthias Christian Schabel // Copyright (C) 2007 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_UNITS_BASE_DIMENSION_IMPL_HPP #define BOOST_UNITS_BASE_DIMENSION_IMPL_HPP #include <boost/mpl/long.hpp> namespace boost { namespace units { namespace detail { typedef char no; struct yes { no dummy[2]; }; template<bool> struct ordinal_has_already_been_defined; template<> struct ordinal_has_already_been_defined<true> { }; template<> struct ordinal_has_already_been_defined<false> { typedef void type; }; } /// This must be in namespace boost::units so that ADL /// will work with friend functions defined inline. /// INTERNAL ONLY template<long N> struct long_ { }; /// Again this needs to be in the same namespace as long_ /// we need a mangled name because it must be found by ADL /// INTERNAL ONLY template<class T> detail::no boost_units_prevent_redefinition(const T&) { return(detail::no()); } /// Ditto. /// INTERNAL ONLY template<class T, long N> struct base_dimension_pair { }; } // namespace units } // namespace boost #endif // BOOST_UNITS_BASE_DIMENSION_IMPL_HPP |
|
From: Matthias S. <mat...@us...> - 2007-04-15 06:51:04
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23868/boost/units Modified Files: base_dimension.hpp Log Message: move base_dimension internals to private Index: base_dimension.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/base_dimension.hpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- base_dimension.hpp 15 Apr 2007 02:09:19 -0000 1.6 +++ base_dimension.hpp 15 Apr 2007 06:51:00 -0000 1.7 @@ -28,33 +28,32 @@ typedef char no; struct yes { no dummy[2]; }; -template<bool> -struct ordinal_has_already_been_defined; +template<bool> struct ordinal_has_already_been_defined; template<> -struct ordinal_has_already_been_defined<true> {}; +struct ordinal_has_already_been_defined<true> { }; template<> -struct ordinal_has_already_been_defined<false> { typedef void type; }; +struct ordinal_has_already_been_defined<false> { typedef void type; }; } /// This must be in namespace boost::units so that ADL /// will work with friend functions defined inline. /// INTERNAL ONLY -template<long N> -struct long_ {}; - -/// Ditto. -/// INTERNAL ONLY -template<class T, long N> -struct base_dimension_pair {}; +template<long N> struct long_ { }; /// Again this needs to be in the same namespace as long_ /// we need a mangled name because it must be found by ADL /// INTERNAL ONLY template<class T> -detail::no boost_units_prevent_double_definition(const T&) { return(detail::no()); } +detail::no +boost_units_prevent_redefinition(const T&) +{ return(detail::no()); } + +/// Ditto. +/// INTERNAL ONLY +template<class T, long N> struct base_dimension_pair { }; /// Defines a base dimension. To define a dimension you need to provide /// the derived class (CRTP) and a unique integer. @@ -64,19 +63,29 @@ template<class Derived, long N, class = typename detail::ordinal_has_already_been_defined< - sizeof(boost_units_prevent_double_definition(units::long_<N>())) == sizeof(detail::yes) && - sizeof(boost_units_prevent_double_definition(units::base_dimension_pair<Derived, N>())) != sizeof(detail::yes) + sizeof(boost_units_prevent_redefinition(units::long_<N>())) == sizeof(detail::yes) && + sizeof(boost_units_prevent_redefinition(units::base_dimension_pair<Derived, N>())) != sizeof(detail::yes) >::type> -struct base_dimension : mpl::long_<N> { - /// Register this ordinal - /// INTERNAL ONLY - friend detail::yes boost_units_prevent_double_definition(const units::long_<N>&) { return(detail::yes()); } - /// But make sure we can identify the current instantiation! - /// INTERNAL ONLY - friend detail::yes boost_units_prevent_double_definition(const units::base_dimension_pair<Derived, N>&) { return(detail::yes()); } - typedef base_dimension this_type; - typedef mpl::long_<N> value; - typedef dimension_list<dim<Derived,static_rational<1> >, dimensionless_type> type; +class base_dimension : + public mpl::long_<N> +{ + public: + typedef base_dimension this_type; + typedef mpl::long_<N> value; + typedef dimension_list<dim<Derived,static_rational<1> >, dimensionless_type> type; + + private: + /// Register this ordinal + /// INTERNAL ONLY + friend detail::yes + boost_units_prevent_redefinition(const units::long_<N>&) + { return(detail::yes()); } + + /// But make sure we can identify the current instantiation! + /// INTERNAL ONLY + friend detail::yes + boost_units_prevent_redefinition(const units::base_dimension_pair<Derived, N>&) + { return(detail::yes()); } }; } // namespace units |
|
From: Steven W. <ste...@us...> - 2007-04-15 02:57:05
|
Update of /cvsroot/boost-sandbox/boost-sandbox/libs/units/example In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26207/boost-sandbox/libs/units/example Modified Files: unit_example_5.cpp Log Message: Supress implicit narrowing conversions Index: unit_example_5.cpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/libs/units/example/unit_example_5.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- unit_example_5.cpp 3 Apr 2007 20:48:07 -0000 1.3 +++ unit_example_5.cpp 15 Apr 2007 02:57:02 -0000 1.4 @@ -32,12 +32,12 @@ volume (cm^3) = 1e+06 cm^3 volume (m^3) = 1 m^3 -energy (joules) = 1 m^2 kg s^(-2) -energy (ergs) = 1e+07 cm^2 g s^(-2) -energy (joules) = 1 m^2 kg s^(-2) +energy (joules) = 1 m^2 kg s^-2 +energy (ergs) = 1e+07 cm^2 g s^-2 +energy (joules) = 1 m^2 kg s^-2 -velocity (2 m/s) = 2 m s^(-1) -velocity (2 cm/s) = 0.02 m s^(-1) +velocity (2 m/s) = 2 m s^-1 +velocity (2 cm/s) = 0.02 m s^-1 //] //[unit_example_5_output_3 @@ -45,11 +45,11 @@ volume (m^3) = 1 m^3 volume (cm^3) = 1e+06 cm^3 -energy (joules) = 1 m^2 kg s^(-2) -energy (ergs) = 1e+07 cm^2 g s^(-2) +energy (joules) = 1 m^2 kg s^-2 +energy (ergs) = 1e+07 cm^2 g s^-2 -velocity (2 m/s) = 2 m s^(-1) -velocity (2 cm/s) = 0.02 m s^(-1) +velocity (2 m/s) = 2 m s^-1 +velocity (2 cm/s) = 0.02 m s^-1 //] @endverbatim @@ -79,7 +79,7 @@ // implicit value_type conversions //[unit_example_5_snippet_1 quantity<SI::length> L1 = quantity<SI::length,int>(int(2.5)*SI::meters); - quantity<SI::length,int> L2 = quantity<SI::length,double>(2.5*SI::meters); + quantity<SI::length,int> L2(quantity<SI::length,double>(2.5*SI::meters)); //] //[unit_example_5_snippet_2 @@ -183,12 +183,12 @@ sstream2 << "volume (cm^3) = " << 1e6 << " cm^3" << std::endl; sstream2 << "volume (m^3) = 1 m^3" << std::endl; sstream2 << std::endl; - sstream2 << "energy (joules) = 1 m^2 kg s^(-2)" << std::endl; - sstream2 << "energy (ergs) = " << 1e7 << " cm^2 g s^(-2)" << std::endl; - sstream2 << "energy (joules) = 1 m^2 kg s^(-2)" << std::endl; + sstream2 << "energy (joules) = 1 m^2 kg s^-2" << std::endl; + sstream2 << "energy (ergs) = " << 1e7 << " cm^2 g s^-2" << std::endl; + sstream2 << "energy (joules) = 1 m^2 kg s^-2" << std::endl; sstream2 << std::endl; - sstream2 << "velocity (2 m/s) = 2 m s^(-1)" << std::endl; - sstream2 << "velocity (2 cm/s) = 0.02 m s^(-1)" << std::endl; + sstream2 << "velocity (2 m/s) = 2 m s^-1" << std::endl; + sstream2 << "velocity (2 cm/s) = 0.02 m s^-1" << std::endl; sstream2 << std::endl; #ifdef BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION sstream2 << std::endl; @@ -196,11 +196,11 @@ sstream2 << "volume (m^3) = 1 m^3" << std::endl; sstream2 << "volume (cm^3) = " << 1e6 << " cm^3" << std::endl; sstream2 << std::endl; - sstream2 << "energy (joules) = 1 m^2 kg s^(-2)" << std::endl; - sstream2 << "energy (ergs) = " << 1e7 << " cm^2 g s^(-2)" << std::endl; + sstream2 << "energy (joules) = 1 m^2 kg s^-2" << std::endl; + sstream2 << "energy (ergs) = " << 1e7 << " cm^2 g s^-2" << std::endl; sstream2 << std::endl; - sstream2 << "velocity (2 m/s) = 2 m s^(-1)" << std::endl; - sstream2 << "velocity (2 cm/s) = 0.02 m s^(-1)" << std::endl; + sstream2 << "velocity (2 m/s) = 2 m s^-1" << std::endl; + sstream2 << "velocity (2 cm/s) = 0.02 m s^-1" << std::endl; sstream2 << std::endl; #endif |