Testing that a particular operator is not alllowed

Is there any way to test at compile time, using a Boost construct, that a particular operator is not allowable for a given type, other than simply compile the code and have the compiler generate an error message when trying to use an operator on an object of that type ? I am writing some tests for an MPL library on which I am working where I want to make sure that a given operator for my template class instantiation object will fail to compile, but I would like to do this in such a way that I can generate a compile time message for the failure rather than an actual compiler error. I suspect this is not possible but I thought I would ask anyway.

Edward Diener wrote:
Is there any way to test at compile time, using a Boost construct, that a particular operator is not allowable for a given type, other than simply compile the code and have the compiler generate an error message when trying to use an operator on an object of that type ?
I am writing some tests for an MPL library on which I am working where I want to make sure that a given operator for my template class instantiation object will fail to compile, but I would like to do this in such a way that I can generate a compile time message for the failure rather than an actual compiler error. I suspect this is not possible but I thought I would ask anyway. Frederic Bron wrote an extensive list of traits meta-function for that. It was in the sandbox but I don't remember if it's in trunk atm.
Here's the link to the initial topic with a proper idea of implementation: http://article.gmane.org/gmane.comp.lib.boost.user/29170

Frederic Bron wrote an extensive list of traits meta-function for that. It was in the sandbox but I don't remember if it's in trunk atm.
You can find here what I did: http://article.gmane.org/gmane.comp.lib.boost.devel/194625 If you browse in the sandbox, you will see in boost/type_traits some files is_..._comparable.hpp. I never finished the action to have it included in boost because at some point some said this was already implemented in a unmaintained library of the sandbox (https://svn.boost.org/trac/boost/wiki/LibrariesUnderConstruction#Boost.Conce...). I still have the project to propose something but lack of time. Frédéric

On 7/9/2010 1:18 AM, Frédéric Bron wrote:
Frederic Bron wrote an extensive list of traits meta-function for that. It was in the sandbox but I don't remember if it's in trunk atm.
You can find here what I did: http://article.gmane.org/gmane.comp.lib.boost.devel/194625 If you browse in the sandbox, you will see in boost/type_traits some files is_..._comparable.hpp.
I see these files.
I never finished the action to have it included in boost because at some point some said this was already implemented in a unmaintained library of the sandbox (https://svn.boost.org/trac/boost/wiki/LibrariesUnderConstruction#Boost.Conce...). I still have the project to propose something but lack of time.
Frédéric
Thanks for the information. Do you know why ConceptTraits was abandoned ? It looks very good.

Edward Diener wrote:
Do you know why ConceptTraits was abandoned ? It looks very good.
It was left out cause at some point, Concepts had great chance to be in the standard, makign this obsolete. Considering the Concepts are now back to attic, it should be a good idea to revive it.

On 7/9/2010 2:15 AM, Joel Falcou wrote:
Edward Diener wrote:
Do you know why ConceptTraits was abandoned ? It looks very good.
It was left out cause at some point, Concepts had great chance to be in the standard, makign this obsolete. Considering the Concepts are now back to attic, it should be a good idea to revive it.
I sent a message to Terje Slettebø, whose e-mail address was in the documentation, and he graciously responded. It is clearly up to him and Tobias Schwinger whether or not they want to revive their work on the CTL and submit it to Boost, but I will use their library as is in the sandbox and see if it fits my immediate needs, as well as looking at Frederick Bron's work. For my own purposes, discovering whether a particular user-defined type implements a particular operator would be very valuable,and any library which has such functionality would be a great addition to Boost.
participants (4)
-
Edward Diener
-
Frédéric Bron
-
joel falcou
-
Joel Falcou