Boost logo

Boost :

From: Jason House (jhouse_at_[hidden])
Date: 2003-03-02 12:23:51


I believe I've seen traffic earlier about some kind of upcoming deadline
for proposals for becoming part of the C++ standard.

I'm thinking that it would be nice to be able to us define distinct
types based on strings (the fundamental type const char * and not
std::string). The intended use is in templates.

Here's one motivating example:
http://groups.yahoo.com/group/boost/files/associative_list/
by Emily Winch

Inside there is a line:
struct a{}; struct b{}; struct c{}; struct d{};

Which is then followed up by calls such as
get<a>(...)
get<b>(...)
...

a,b,c,d are all empty structures, with the only goal of getting distinct
types (this easily could have human readable forms, like an address book
example: struct FirstName{}; struct PhoneNumber{}; etc...)

I guess what I want to know is:
  Does anyone know of other motivating examples, especially within other
parts of boost?
  Any arguments as to why this is the worst idea ever?
  How about the best? ;)

It seems like such functionality would be a convenience to the
programmer. It would also make conversion of the type to a string
format very easy ;) While that seems like a side topic, I'm sure that
there are interesting ways to tie that in.

For the moment, I'm just curious to see the reactions to the idea.


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