Boost logo

Boost :

Subject: Re: [boost] identifying a string type
From: Joel Falcou (joel.falcou_at_[hidden])
Date: 2009-06-08 03:01:03


Steven Ross wrote:
> Is there a boolean argument that can be used to identify whether a data type
> is some form of string that has a [] operator that returns an integer data
> type (preferably 2 or less bytes in size)?
> I now am using enable_if so that strings and floats are identified and the
> proper specialized call is made for them when spread_sort is called by the
> user. It would be nice to automatically identify strings too inside
> enable_if, so that the user can just call "spread_sort" and the correct
> specialized and optimized sorting call will be made depending on the data
> type for integers, floats, and strings, and std::sort will be called for
> unsupported data types.
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
Well you cna easily write a small traits meta-functions using sizeof
trick to detect the presence of operator[]
Check the Introspection.zip file in the vault, there is prototype for
such thing


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk