Operator overloading

Sergey Gromov snake.scaly at gmail.com
Wed Dec 24 13:17:14 PST 2008


Tue, 23 Dec 2008 19:14:16 -0500, Christopher Wright wrote:

> Denis Koroskin wrote:
>> Slightly off-topic.
>> 
>> How would you implement, say, LIKE condition? Similar to the following, perhaps:
>> Query query = Select(a).Where(id.Like("%substring%"));
>> 
>> You could implement "==" the same way:
>> Query query = Select(a).Where(id.EqualsTo(5));
> 
> downs way:
> auto query1 = select(a) /where/ "id" /eq/ 5;
> auto query2 = select(a) /where/ "name" /like/ "%bob%";

What a nice trick!

I don't like operator abuse, but sometimes it's a lesser evil.  And it's
definitely the case with SQL queries.



More information about the Digitalmars-d mailing list