Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion operator belongs_to
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Andrei Alexandrescu  
View profile  
 More options Mar 13 2003, 8:25 am
Newsgroups: comp.lang.c++.moderated
From: "Andrei Alexandrescu" <SeeWebsiteForEm...@moderncppdesign.com>
Date: 13 Mar 2003 08:11:20 -0500
Local: Thurs, Mar 13 2003 8:11 am
Subject: Re: operator belongs_to
"Alex Vinokur" <ale...@bigfoot.com> wrote in message

news:b4mbue$21fr5e$1@ID-79865.news.dfncis.de...
 > Is it possible to define something like to operator belongs_to ?
 >
 > For instance, I would like to know is some int-value val1 belongs to
vector<int> vect1.
 >
 > Instead of using find-algorithm I would prefer to use operator belongs_to.

A while back I've been toying with a combination of macros and templates
that would allow you to write:

vector<int> v;
...
if (5 BELONGS_TO v) { ... }

The idea was to define BELONGS_TO like this:

#define BELONGS_TO *belongs_to*

and then define belongs_to as a global object with the appropriate *
operators.

The scaffolding is quite interesting, but overall I find the idea too whacky
to be acceptable. I kept it on hold just in case I'll run out of ideas for
my Generic<Programming> column, and hopefully I'll never need to use it :o).

Andrei

      [ Send an empty e-mail to c++-h...@netlab.cs.rpi.edu for info ]
      [ about comp.lang.c++.moderated. First time posters: do this! ]


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google