library of assembled shared sources

http://lass.cocamware.com

meta_assert.h File Reference

#include "meta_common.h"

Include dependency graph for meta_assert.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


Data Structures

struct  lass::meta::impl::MetaAssertor< false >
struct  lass::meta::impl::MetaAssertTest< x >

Namespaces

namespace  lass
 Library for Assembled Shared Sources.
namespace  lass::meta
 library for template meta programming
namespace  lass::meta::impl

Defines

#define LASS_META_ASSERT(expression__, message__)
 complite time static check


Detailed Description

Author:
Bram de Greve (bramz@users.sourceforge.net)

Tom De Muer (tomdemuer@users.sourceforge.net)

*** BEGIN LICENSE INFORMATION ***

The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://lass.sourceforge.net/cpal-license. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B.

Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

The Original Code is LASS - Library of Assembled Shared Sources.

The Initial Developer of the Original Code is Bram de Greve and Tom De Muer. The Original Developer is the Initial Developer.

All portions of the code written by the Initial Developer are: Copyright (C) 2004-2007 the Initial Developer. All Rights Reserved.

Contributor(s):

Alternatively, the contents of this file may be used under the terms of the GNU General Public License Version 2 or later (the GPL), in which case the provisions of GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the GPL and not to allow others to use your version of this file under the CPAL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL License. If you do not delete the provisions above, a recipient may use your version of this file under either the CPAL or the GPL.

*** END LICENSE INFORMATION ***

Definition in file meta_assert.h.


Define Documentation

#define LASS_META_ASSERT ( expression__,
message__   ) 

Value:

typedef lass::meta::impl::MetaAssertTest<\
        sizeof(lass::meta::impl::MetaAssertor<((expression__) == 0)>)>\
    LASS_META_ASSERT_##message__
complite time static check

Author:
Bram de Greve [BdG]
Parameters:
expression__ the meta expression to be evaluated, should evaluate to bool value.
message__ the_message_to_be_displayed_if_the_assertion_failed. This message should obey the rules of a valid type name. You must concatenate different words with underscores.
This macro checks if an expression evaluates true at compile time. If so, nothing happens. But if it fails, the compiler will generate some error mentioning iMessage. In fact, it will complain about something else (causing the compiler error), but while it does so, it will generate you message. Cunning huh?

Here's how it looks like:

  LASS_META_ASSERT(1 + 1 == 3, it_s_the_end_of_the_world);

  // MSVC 7.0 compiler error:
  // error C2087: 'LASS_META_ASSERT_FAILURE_it_s_the_end_of_the_world' : missing subscript

  // Intel 700 compiler error:
  // error: an array may not have elements of this type LASS_META_ASSERT(1 + 1 == 3, it_s_the_end_of_the_world);

original code by Andrei Alexandrescu:
The Loki Library, Copyright (c) 2001 by Andrei Alexandrescu
This code (Loki) accompanies the book:
Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design Patterns Applied". Copyright (c) 2001. Addison-Wesley.
Permission to use, copy, modify, distribute and sell this software (Loki) for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation.
The author or Addison-Wesley Longman make no representations about the suitability of this software (Loki) for any purpose. It is provided "as is" without express or implied warranty.

Definition at line 105 of file meta_assert.h.

Referenced by lass::num::Matrix< T, S >::at(), lass::util::atomicCompareAndSwap(), lass::io::BinaryIFile::doSeekg(), lass::io::BinaryOFile::doSeekp(), lass::num::Matrix< T, S >::invert(), lass::num::Matrix< T, S >::Matrix(), lass::num::Matrix< T, S >::operator()(), lass::num::Matrix< T, S >::operator*=(), lass::num::Matrix< T, S >::operator+=(), lass::num::Matrix< T, S >::operator-=(), lass::num::Matrix< T, S >::operator/=(), lass::io::BinaryOStream::operator<<(), lass::num::Matrix< T, S >::operator=(), lass::io::BinaryIStream::operator>>(), lass::num::Matrix< T, S >::setIdentity(), lass::num::Matrix< T, S >::setZero(), lass::num::Matrix< T, S >::solve(), and lass::num::Matrix< T, S >::swap().


Generated on Mon Nov 10 14:22:05 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo