Re: [boost] identifying a string type

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.

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

On Mon, Jun 8, 2009 at 12:01 AM, Joel Falcou <joel.falcou@lri.fr> wrote:
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)?
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
Thanks for the suggestion Joel. I took a look at that and it appears to do what I need (haven't tested), but is too complicated for me to support separately just for my Boost.Algorithm.Sorting proposal, where it isn't a critical need. Is Introspection going to be added to Boost?

is too complicated for me to support separately just for my Boost.Algorithm.Sorting proposal, where it isn't a critical need. Is Introspection going to be added to Boos Well, it's pretty much extarctabel as itself. If needed I can lend you a hand and make the appropriate specialisation for your need.
Concernign addition to bosot, well, I still haev to hammering it out and go through the review process -- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35

On Tue, Jun 9, 2009 at 5:10 AM, joel <joel.falcou@lri.fr> wrote:
is too complicated for me to support
separately just for my Boost.Algorithm.Sorting proposal, where it isn't a critical need. Is Introspection going to be added to Boos
Well, it's pretty much extarctabel as itself. If needed I can lend you a hand and make the appropriate specialisation for your need.
Concernign addition to bosot, well, I still haev to hammering it out and go through the review process
No thanks; I may extract it and add it myself if there is demand, but otherwise I'm in the middle of trying to get my library accepted, and it isn't a critical feature. That said, Introspection is useful, and I hope it makes it into Boost.

On Sun, Jun 7, 2009 at 10:36 PM, Steven Ross<spreadsort@gmail.com> 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)?
A portability warning: sizeof(wchar_t) might be more than 2. Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode

On Mon, Jun 8, 2009 at 12:16 AM, Emil Dotchevski <emildotchevski@gmail.com>wrote:
On Sun, Jun 7, 2009 at 10:36 PM, Steven Ross<spreadsort@gmail.com> 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)?
A portability warning: sizeof(wchar_t) might be more than 2.
Understood. That's why I'll have a corresponding disable_if calling std::sort on those data types. A hybrid sort designed to work efficiently with large characters would be substantially more complicated, and I'm not sure it would be faster than std::sort on real strings.

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)?
Check for Random Access Range with a value type that fills your criteria.
participants (5)
-
Emil Dotchevski
-
joel
-
Joel Falcou
-
Mathias Gaunard
-
Steven Ross