Boost logo

Boost :

Subject: [boost] [string_ref] Add an equality operator between string_ref and char*
From: Nicola Bizzoca (nicola.bizzoca_at_[hidden])
Date: 2013-05-17 12:11:00


Hi,
string_ref currently lacks of a simple and efficient way to compare a
string_ref data to a C style string

The current way that string_ref promotes is:
string_ref_data.compare("boost_at_[hidden]") == 0

It's error prone (always checking for 0, < 0, > 0) and involves a series of
implicit casting (from char* to string, and from string to string view)

The same it's valid for comparing string_ref to string, but is this case an
implicit casting from string to string_ref is much less expensive


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