|
Boost : |
From: Andreas Huber (ahd6974-spamboostorgtrap_at_[hidden])
Date: 2007-08-12 05:35:08
"Steven Watanabe" <steven_at_[hidden]> wrote in message
news:loom.20070811T184620-255_at_post.gmane.org...
>> See above, your finding of flaws with these warnings is not exactly
>> common.
>
> It's happened to me too. I was accidentally passing a reference
> type to alignment_of. I knew there was a problem in my code
> but the warning helped my find it immediately. If you really
> need to suppress this warning for users you can write
>
> template<class T>
> class C {
> public:
> C(const C& c) {
> BOOST_STATIC_ASSERT((!boost::is_same<T, T>::value));
> }
> C& operator=(const C& c) {
> BOOST_STATIC_ASSERT((!boost::is_same<T, T>::value));
> }
> };
I don't see how this could work for my situation, see my answer to John.
Statechart users derive their normal (non-template) classes from the class
template statechart::simple_state. Unless I'm missing something, adding
static asserts to simple_state (as you do in the class template C) would not
work as the compiler would then try to generate copy functions for the
user-defined classes only to issue an error when it tries to instantiate
simple_state copy functions.
I ask again: If you really do care so much about these warnings then why
don't you simply reenable them after including the headers that disable
them? As Bo has mentioned, chances are that other headers that you include
also disable these warnings.
-- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk