Boost logo

Boost :

Subject: Re: [boost] [Hana] Announcing Hana's formal review next week (June 10th)
From: Louis Dionne (ldionne.2_at_[hidden])
Date: 2015-06-12 14:17:19


Paul Fultz II <pfultz2 <at> yahoo.com> writes:

>
> > > I am probably missing something, but can't you check that the first
> > > element of every pair going into the map is a compile-time constant.
> > « []
> >
> > No, because not only compile-time constants can be used as the keys of a
> > Map.
>
> Yes, but as a simple smoke screen, you could always check that the key
> compared against itself will return an `IntregralConstant`. That should
> always be required to be valid, and it would help catch errors earlier on.

That's an interesting idea, and I just implemented this for both Set and Map.
For illustration, here's what happens when

1. creating a Map with something else than pairs:

    auto m = make_map(1);

    error: static_assert failed
 €€€€€‰¡…¹„èéµ…­”ñ5…Àø¡Á…¥É̸¸¸¤É•Åեɕ́…±°Ñ¡”€Á…¥ÉÌœÑ¼‰”Aɽ‘ՍÑ̈(€€€€€€€€€€€€€€€ÍÑ…Ñ¥}…ÍÍ•ÉС¡…¹„èé…±°¡…É•}Á…¥É̤°(€€€€€€€€€€€€€€€x€€€€€€€€€€€€ùùùùùùùùùùùùùùùùùùùø(((ȸÉ•…Ñ¥¹œ„5…ÀÝ¥Ñ ¹½¸µ ½µÁ…É…‰±”­•åÌè((€€€ÍÑÉՍЁ½¼ìôì(€€€…ÕѼ´€ôµ…­•}µ…À¡µ…­•}Á…¥È¡½½íô°€‰½¹”ˆ¤¤ì((€€€•ÉɽÈèÍÑ…Ñ¥}…ÍÍ•ÉЁ™…¥±•€(€€€€€€€€‰¡…¹„èéµ…­”ñ5…Àø¡Á…¥É̸¸¸¤É•Åեɕ́…±°Ñ¡”­•ǻѼ‰” ½µÁ…É…‰±”ˆ(€€€€€€€€€€€€€€€ÍÑ…Ñ¥}…ÍÍ•ÉС¡…¹„èé…±°¡…É•} ½µÁ…É…‰±”¤°(€€€€€€€€€€€€€€€x€€€€€€€€€€€€ùùùùùùùùùùùùùùùùùùùùùùùùø(((̸É•…Ñ¥¹œ„5…ÀÝ¥Ñ ­•ǻѡ…Ё…É”½‰Ù¥½Õͱ䁹½Ð ½µÁ…É…‰±”…Ё½µÁ¥±”µÑ¥µ”((€€€…ÕѼ´€ôµ…­•}µ…À¡µ…­•}Á…¥È Ä°€‰½¹”ˆ¤¤ì((€€€•ÉɽÈèÍÑ…Ñ¥}…ÍÍ•ÉЁ™…¥±•€(€€€€€€€€‰¡…¹„èéµ…­”ñ5…Àø¡Á…¥É̸¸¸¤É•Åեɕ́…±°Ñ¡”­•ǻѼ‰” ½µÁ…É…‰±”(€€€€€€€€€€€€…Ё½µÆR×F–ÖR ¢7FF–5ö76W'B††æ£¦Ɔ&Uö6ö×–ÆU÷F–ÖUô6ö×&&ÆR’À¢âçççççççççççççççççççççççççççççççççççççà  ¥6–Ö–Æ"W'&÷"ÖW76vW2&RF‡&÷vâ'’6WBv†VâW6–æræöâÔ6ö×&&ÆR÷"


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