Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-11-03 17:47:32

Daniel Earwicker <daniel.earwicker_at_[hidden]> writes:

> Oooh, that's much better. With used_keywords as an empty set in
> empty_arg_list, all it needs in arg_list is:
> BOOST_STATIC_ASSERT((!boost::mpl::has_key<
> typename Next::used_keywords, key_type>::type::value));


> typedef typename mpl::insert<typename Next::used_keywords,
> key_type>::type used_keywords;
> Or is there already something that captures the above pattern, i.e.
> refuses to insert a duplicate?

Not that I know of.

Actually in this case I think I'd prefer to see a solution using
overloading directly, just to cut down on instantiations. The
arg_list, after all, is almost the same structure as the set already.
Something like:

  static char (& has_key(K const&) )[2];

        sizeof(Next::has_key(make<K>())) == 1
      , duplicate_keyword, (K)

If you could submit a patch to the current CVS along with an
expected-compilation-failure test case, I'd be happy to apply it.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at