blog dds

2005.12.07

If STL Had Been Designed by a Committee

I've been reading on XML schema, and it's embarrassingly obvious that it has been designed by a committee.

The facets for restricting a simple type include the following:

  • minInclusive
  • minExclusive
  • maxInclusive
  • maxExclusive
so that one can specify any type of inclusive or exclusive range on both ends. And if the regular expression repetition specifiers are not enough, one can also separately specify
  • length
  • minlenth
  • maxlength

On the C++ STL front, the same committee would grace us the following new container methods:

const_iterator begin_inclusive() const;
const_iterator end_inclusive() const;
reverse_iterator rbegin_inclusive();
reverse_iterator rend_inclusive();
const_iterator begin_exclusive() const;
const_iterator end_exclusive() const;
reverse_iterator rbegin_exclusive();
reverse_iterator rend_exclusive();
int element_ordinal(iterator pos) const;
void set_element_ordinal(iterator pos, int n);

Read and post comments, or share through   


Creative Commons License Last modified: Wednesday, December 7, 2005 3:40 pm
Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-Share Alike 3.0 Greece License.