add comparison to c-string for Literal
This commit is contained in:
parent
34dc8fa4de
commit
09c0cacee2
1 changed files with 27 additions and 0 deletions
|
|
@ -51,6 +51,7 @@ namespace lib {
|
|||
/** inline string literal
|
||||
* @todo improve interaction with Symbol
|
||||
* @todo make it non-nullable
|
||||
* @todo maybe use boost/operators Ticket #417
|
||||
*/
|
||||
class Literal
|
||||
{
|
||||
|
|
@ -126,6 +127,32 @@ namespace lib {
|
|||
return ! (sy1 == sy2);
|
||||
}
|
||||
|
||||
/// comparison with c-strings //////TICKET #417
|
||||
inline bool
|
||||
operator== (Literal sy1, const char* const sy2)
|
||||
{
|
||||
return (sy1 == Literal(sy2));
|
||||
}
|
||||
|
||||
inline bool
|
||||
operator== (const char* const sy1, Literal sy2)
|
||||
{
|
||||
return (Literal(sy1) == sy2);
|
||||
}
|
||||
|
||||
inline bool
|
||||
operator!= (Literal sy1, const char* const sy2)
|
||||
{
|
||||
return ! (sy1 == Literal(sy2));
|
||||
}
|
||||
|
||||
inline bool
|
||||
operator!= (const char* const sy1, Literal sy2)
|
||||
{
|
||||
return ! (Literal(sy1) == sy2);
|
||||
}
|
||||
|
||||
/// string concatenation
|
||||
inline std::string
|
||||
operator+ (std::string str, Literal const& sym)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue