Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1754 for code


Ignore:
Timestamp:
Sep 9, 2008, 10:25:33 PM (16 years ago)
Author:
rgrieder
Message:

Bugfix that didn't show with msvc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core3/src/util/Convert.h

    r1753 r1754  
    384384        return convert(output, input, ImplicitPossible<probe>());
    385385    }
    386 
    387     // template that is used when no explicit template specialisation is available
    388     // try explicitConversion() function next.
    389     template <class ToType, class FromType>
    390     struct ConverterExplicit
    391     {
    392         static bool convert(ToType* output, const FromType& input)
    393         {
    394             // check for explicit conversion via function overloading
    395             const bool probe = ExplicitConversion<FromType, ToType>::exists;
    396             // why conversion:: ? --> below is a 'using' directive, so this template usually
    397             // gets instantiated in global namespace
    398             return conversion::convert(output, input, ExplicitPossible<probe>());
    399         }
    400     };
    401 }
     386}
     387
     388// We usually don't have a namespace in util/ but it would still be desirable to lock
     389// everything internal away in namespace conversion.
     390// However this template can be specialised everywhere.
     391
     392// Template that is used when no explicit template specialisation is available
     393// try explicitConversion() function next.
     394template <class ToType, class FromType>
     395struct ConverterExplicit
     396{
     397    static bool convert(ToType* output, const FromType& input)
     398    {
     399        // check for explicit conversion via function overloading
     400        const bool probe = ExplicitConversion<FromType, ToType>::exists;
     401        return conversion::convert(output, input, conversion::ExplicitPossible<probe>());
     402    }
     403};
    402404
    403405
     
    405407// Public Functions //
    406408//////////////////////
    407 
    408 // We usually don't have a namespace in util/ but it would still be desirable to lock
    409 // everything internal away in namespace conversion.
    410 using conversion::ConverterExplicit;
    411409
    412410/**
     
    456454inline ToType getConvertedValue(const FromType& input, const ToType& fallback)
    457455{
    458     ToType output = fallback;
     456    ToType output;
    459457    ConvertValue(&output, input, fallback);
    460458    return output;
     
    475473inline ToType conversion_cast(const FromType& input, const ToType& fallback)
    476474{
    477     ToType output = fallback;
     475    ToType output;
    478476    ConvertValue(&output, input, fallback);
    479477    return output;
Note: See TracChangeset for help on using the changeset viewer.