From: <ric...@us...> - 2011-09-23 00:46:29
|
Revision: 1115 http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1115&view=rev Author: rich_sposato Date: 2011-09-23 00:46:21 +0000 (Fri, 23 Sep 2011) Log Message: ----------- Added text of MIT License. Modified Paths: -------------- trunk/include/loki/AbstractFactory.h trunk/include/loki/Allocator.h trunk/include/loki/AssocVector.h trunk/include/loki/CachedFactory.h trunk/include/loki/CheckReturn.h trunk/include/loki/Checker.h trunk/include/loki/ConstPolicy.h trunk/include/loki/DataGenerators.h trunk/include/loki/EmptyType.h trunk/include/loki/Factory.h trunk/include/loki/ForEachType.h trunk/include/loki/Function.h trunk/include/loki/Functor.h trunk/include/loki/HierarchyGenerators.h trunk/include/loki/Key.h trunk/include/loki/LevelMutex.h trunk/include/loki/LockingPtr.h trunk/include/loki/LokiExport.h trunk/include/loki/LokiTypeInfo.h trunk/include/loki/MultiMethods.h trunk/include/loki/NullType.h trunk/include/loki/OrderedStatic.h trunk/include/loki/Pimpl.h trunk/include/loki/RefToValue.h trunk/include/loki/Register.h trunk/include/loki/SPCachedFactory.h trunk/include/loki/SafeBits.h trunk/include/loki/SafeFormat.h trunk/include/loki/ScopeGuard.h trunk/include/loki/Sequence.h trunk/include/loki/Singleton.h trunk/include/loki/SmallObj.h trunk/include/loki/SmartPtr.h trunk/include/loki/StrongPtr.h trunk/include/loki/ThreadLocal.h trunk/include/loki/Threads.h trunk/include/loki/Tuple.h trunk/include/loki/TypeManip.h trunk/include/loki/TypeTraits.h trunk/include/loki/Typelist.h trunk/include/loki/TypelistMacros.h trunk/include/loki/Visitor.h trunk/include/loki/static_check.h Modified: trunk/include/loki/AbstractFactory.h =================================================================== --- trunk/include/loki/AbstractFactory.h 2011-09-21 23:24:54 UTC (rev 1114) +++ trunk/include/loki/AbstractFactory.h 2011-09-23 00:46:21 UTC (rev 1115) @@ -4,13 +4,26 @@ // This code 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 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 for any purpose. It is provided "as is" -// without express or implied warranty. +// +// Code covered by the MIT License +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_ABSTRACTFACTORY_INC_ #define LOKI_ABSTRACTFACTORY_INC_ Modified: trunk/include/loki/Allocator.h =================================================================== --- trunk/include/loki/Allocator.h 2011-09-21 23:24:54 UTC (rev 1114) +++ trunk/include/loki/Allocator.h 2011-09-23 00:46:21 UTC (rev 1115) @@ -2,13 +2,23 @@ // The Loki Library // Copyright (c) 2008 by Rich Sposato // -// Permission to use, copy, modify, distribute and sell this software 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 makes no representations about the -// suitability of this software for any purpose. It is provided "as is" -// without express or implied warranty. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_ALLOCATOR_HPP_INCLUDED Modified: trunk/include/loki/AssocVector.h =================================================================== --- trunk/include/loki/AssocVector.h 2011-09-21 23:24:54 UTC (rev 1114) +++ trunk/include/loki/AssocVector.h 2011-09-23 00:46:21 UTC (rev 1115) @@ -2,15 +2,26 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// 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 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 for any purpose. It is provided "as is" -// without express or implied warranty. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_ASSOCVECTOR_INC_ #define LOKI_ASSOCVECTOR_INC_ @@ -42,21 +53,21 @@ public: AssocVectorCompare() {} - + AssocVectorCompare(const C& src) : C(src) {} - - bool operator()(const first_argument_type& lhs, + + bool operator()(const first_argument_type& lhs, const first_argument_type& rhs) const { return C::operator()(lhs, rhs); } - + bool operator()(const Data& lhs, const Data& rhs) const { return operator()(lhs.first, rhs.first); } - - bool operator()(const Data& lhs, + + bool operator()(const Data& lhs, const first_argument_type& rhs) const { return operator()(lhs.first, rhs); } - + bool operator()(const first_argument_type& lhs, const Data& rhs) const { return operator()(lhs, rhs.first); } @@ -82,7 +93,7 @@ class C = std::less<K>, class A = std::allocator< std::pair<K, V> > > - class AssocVector + class AssocVector : private std::vector< std::pair<K, V>, A > , private Private::AssocVectorCompare<V, C> { @@ -112,7 +123,7 @@ , private key_compare { friend class AssocVector; - + protected: value_compare(key_compare pred) : key_compare(pred) {} @@ -121,27 +132,27 @@ bool operator()(const value_type& lhs, const value_type& rhs) const { return key_compare::operator()(lhs.first, rhs.first); } }; - + // 23.3.1.1 construct/copy/destroy - explicit AssocVector(const key_compare& comp = key_compare(), + explicit AssocVector(const key_compare& comp = key_compare(), const A& alloc = A()) : Base(alloc), MyCompare(comp) {} - + template <class InputIterator> - AssocVector(InputIterator first, InputIterator last, - const key_compare& comp = key_compare(), + AssocVector(InputIterator first, InputIterator last, + const key_compare& comp = key_compare(), const A& alloc = A()) : Base(first, last, alloc), MyCompare(comp) { MyCompare& me = *this; std::sort(begin(), end(), me); } - + AssocVector& operator=(const AssocVector& rhs) - { - AssocVector(rhs).swap(*this); + { + AssocVector(rhs).swap(*this); return *this; } @@ -155,7 +166,7 @@ const_reverse_iterator rbegin() const { return Base::rbegin(); } reverse_iterator rend() { return Base::rend(); } const_reverse_iterator rend() const { return Base::rend(); } - + // capacity: bool empty() const { return Base::empty(); } size_type size() const { return Base::size(); } @@ -182,18 +193,18 @@ //http://developer.apple.com/documentation/DeveloperTools/gcc-3.3/libstdc++/23_containers/howto.html#4 iterator insert(iterator pos, const value_type& val) { - if( (pos == begin() || this->operator()(*(pos-1),val)) && + if( (pos == begin() || this->operator()(*(pos-1),val)) && (pos == end() || this->operator()(val, *pos)) ) { return Base::insert(pos, val); } return insert(val).first; } - + template <class InputIterator> void insert(InputIterator first, InputIterator last) { for (; first != last; ++first) insert(*first); } - + void erase(iterator pos) { Base::erase(pos); } @@ -215,7 +226,7 @@ MyCompare& rhs = other; std::swap(me, rhs); } - + void clear() { Base::clear(); } @@ -241,7 +252,7 @@ } const_iterator find(const key_type& k) const - { + { const_iterator i(lower_bound(k)); if (i != end() && this->operator()(k, i->first)) { @@ -351,7 +362,7 @@ template <class K, class V, class C, class A> void swap(AssocVector<K, V, C, A>& lhs, AssocVector<K, V, C, A>& rhs) { lhs.swap(rhs); } - + } // namespace Loki #endif // end file guardian Modified: trunk/include/loki/CachedFactory.h =================================================================== --- trunk/include/loki/CachedFactory.h 2011-09-21 23:24:54 UTC (rev 1114) +++ trunk/include/loki/CachedFactory.h 2011-09-23 00:46:21 UTC (rev 1115) @@ -4,14 +4,24 @@ // // Code covered by the MIT License // -// Permission to use, copy, modify, distribute and sell this software 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. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// The authors make no representations about the suitability of this software -// for any purpose. It is provided "as is" without express or implied warranty. +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. // +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// // This code DOES NOT accompany the book: // Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. Modified: trunk/include/loki/CheckReturn.h =================================================================== --- trunk/include/loki/CheckReturn.h 2011-09-21 23:24:54 UTC (rev 1114) +++ trunk/include/loki/CheckReturn.h 2011-09-23 00:46:21 UTC (rev 1115) @@ -1,13 +1,26 @@ //////////////////////////////////////////////////////////////////////////////// // The Loki Library // Copyright (c) 2007 by Rich Sposato -// Permission to use, copy, modify, distribute and sell this software 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 makes no representations about the -// suitability of this software for any purpose. It is provided "as is" -// without express or implied warranty. +// +// Code covered by the MIT License +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_CHECK_RETURN_INC_ Modified: trunk/include/loki/Checker.h =================================================================== --- trunk/include/loki/Checker.h 2011-09-21 23:24:54 UTC (rev 1114) +++ trunk/include/loki/Checker.h 2011-09-23 00:46:21 UTC (rev 1115) @@ -4,14 +4,26 @@ // Copyright (c) 2008, 2009 Rich Sposato // The copyright on this file is protected under the terms of the MIT license. // -// Permission to use, copy, modify, distribute and sell this software 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. +// Code covered by the MIT License // -// The author makes no representations about the suitability of this software -// for any purpose. It is provided "as is" without express or implied warranty. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// //////////////////////////////////////////////////////////////////////////////// // $Id$ Modified: trunk/include/loki/ConstPolicy.h =================================================================== --- trunk/include/loki/ConstPolicy.h 2011-09-21 23:24:54 UTC (rev 1114) +++ trunk/include/loki/ConstPolicy.h 2011-09-23 00:46:21 UTC (rev 1115) @@ -2,13 +2,26 @@ // The Loki Library // Copyright (c) 2006 Richard Sposato // Copyright (c) 2006 Peter K\xFCmmel -// Permission to use, copy, modify, distribute and sell this software 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 authors make no representations about the -// suitability of this software for any purpose. It is provided "as is" -// without express or implied warranty. +// +// Code covered by the MIT License +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_CONST_POLICY_INC_ #define LOKI_CONST_POLICY_INC_ Modified: trunk/include/loki/DataGenerators.h =================================================================== --- trunk/include/loki/DataGenerators.h 2011-09-21 23:24:54 UTC (rev 1114) +++ trunk/include/loki/DataGenerators.h 2011-09-23 00:46:21 UTC (rev 1115) @@ -5,9 +5,26 @@ // Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. // -// Code covered by the MIT License -// The author makes no representations about the suitability of this software -// for any purpose. It is provided "as is" without express or implied warranty. +// Code covered by the MIT License: +// Copyright(c) 2010 Shannon Barber +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_DATAGENERATORS_INC_ #define LOKI_DATAGENERATORS_INC_ Modified: trunk/include/loki/EmptyType.h =================================================================== --- trunk/include/loki/EmptyType.h 2011-09-21 23:24:54 UTC (rev 1114) +++ trunk/include/loki/EmptyType.h 2011-09-23 00:46:21 UTC (rev 1115) @@ -2,15 +2,28 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// 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 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 for any purpose. It is provided "as is" -// without express or implied warranty. +// +// Code covered by the MIT License +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_EMPTYTYPE_INC_ #define LOKI_EMPTYTYPE_INC_ @@ -27,18 +40,18 @@ //////////////////////////////////////////////////////////////////////////////// class EmptyType {}; - - + + inline bool operator==(const EmptyType&, const EmptyType&) { return true; - } + } inline bool operator<(const EmptyType&, const EmptyType&) { return false; } - + inline bool operator>(const EmptyType&, const EmptyType&) { return false; Modified: trunk/include/loki/Factory.h =================================================================== --- trunk/include/loki/Factory.h 2011-09-21 23:24:54 UTC (rev 1114) +++ trunk/include/loki/Factory.h 2011-09-23 00:46:21 UTC (rev 1115) @@ -7,8 +7,24 @@ // Patterns Applied". Copyright (c) 2001. Addison-Wesley. // // Code covered by the MIT License -// The authors make no representations about the suitability of this software -// for any purpose. It is provided "as is" without express or implied warranty. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_FACTORYPARM_INC_ #define LOKI_FACTORYPARM_INC_ Modified: trunk/include/loki/ForEachType.h =================================================================== --- trunk/include/loki/ForEachType.h 2011-09-21 23:24:54 UTC (rev 1114) +++ trunk/include/loki/ForEachType.h 2011-09-23 00:46:21 UTC (rev 1115) @@ -2,13 +2,25 @@ // The Loki Library // Copyright (C) 2009 Andy Balaam // Copyright (c) 2009 Peter Kümmel -// Permission to use, copy, modify, distribute and sell this software 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 makes no representations about the -// suitability of this software for any purpose. It is provided "as is" -// without express or implied warranty. +// Code covered by the MIT License +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_FOR_EACH_TYPE @@ -34,7 +46,7 @@ // type of recursive function template <class TList, class Callable> struct ForEachTypeImpl; - + // Recursion rule template <class Head, class Tail, class Callable> struct ForEachTypeImpl<Typelist<Head, Tail>, Callable> @@ -42,7 +54,7 @@ { enum { value = 1 + ForEachTypeImpl<Tail, Callable>::value }; - ForEachTypeImpl( Callable& callable ) : ForEachTypeImpl<Tail, Callable>(callable) + ForEachTypeImpl( Callable& callable ) : ForEachTypeImpl<Tail, Callable>(callable) { #ifdef _MSC_VER callable.operator()<value, Head>(); @@ -50,12 +62,12 @@ callable.template operator()<value, Head>(); #endif } - + }; // Recursion end template <class Head, class Callable> - struct ForEachTypeImpl<Typelist<Head, NullType>, Callable> + struct ForEachTypeImpl<Typelist<Head, NullType>, Callable> { public: @@ -70,8 +82,8 @@ #endif } }; - + } Modified: trunk/include/loki/Function.h =================================================================== --- trunk/include/loki/Function.h 2011-09-21 23:24:54 UTC (rev 1114) +++ trunk/include/loki/Function.h 2011-09-23 00:46:21 UTC (rev 1115) @@ -1,13 +1,26 @@ //////////////////////////////////////////////////////////////////////////////// // The Loki Library // Copyright (c) 2005 Peter K\xFCmmel -// Permission to use, copy, modify, distribute and sell this software 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 makes no representations about the -// suitability of this software for any purpose. It is provided "as is" -// without express or implied warranty. +// +// Code covered by the MIT License +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_FUNCTION_INC_ #define LOKI_FUNCTION_INC_ @@ -30,17 +43,17 @@ /// /// \ingroup FunctorGroup /// Allows a boost/TR1 like usage of Functor. - /// + /// /// \par Usage /// /// - free functions: e.g. \code Function<int(int,int)> f(&freeFunction); /// \endcode - /// - member functions: e.g \code Function<int()> f(&object,&ObjectType::memberFunction); + /// - member functions: e.g \code Function<int()> f(&object,&ObjectType::memberFunction); /// \endcode /// /// see also test/Function/FunctionTest.cpp (the modified test program from boost) //////////////////////////////////////////////////////////////////////////////// - + template<class R = void()> struct Function; @@ -52,29 +65,29 @@ Function() : FBase() {} - Function(const Function& func) : FBase() + Function(const Function& func) : FBase() { - if( !func.empty()) + if( !func.empty()) FBase::operator=(func); } - + // test on emptiness - template<class R2> - Function(Function<R2()> func) : FBase() + template<class R2> + Function(Function<R2()> func) : FBase() { if(!func.empty()) FBase::operator=(func); } - + // clear by '= 0' Function(const int i) : FBase() - { + { if(i==0) FBase::clear(); else throw std::runtime_error("Loki::Function(const int i): i!=0"); } - + template<class Func> Function(Func func) : FBase(func) {} @@ -113,7 +126,7 @@ template<class Host, class Func> \ Function(const Host& host, const Func& func): FBase(host,func) {} - + #define LOKI_FUNCTION_R2_CTOR_BODY \ \ : FBase() \ @@ -132,77 +145,77 @@ : public Loki::Functor<> { typedef Functor<> FBase; - + template<class R2> - Function(Function<R2()> func) + Function(Function<R2()> func) LOKI_FUNCTION_R2_CTOR_BODY - LOKI_FUNCTION_BODY // if compilation breaks here then + LOKI_FUNCTION_BODY // if compilation breaks here then // Function.h was not included before // Functor.h, check your include order - // or define LOKI_ENABLE_FUNCTION + // or define LOKI_ENABLE_FUNCTION }; template<class R,class P01> - struct Function<R(P01)> + struct Function<R(P01)> : public Loki::Functor<R, Seq<P01> > { typedef Functor<R, Seq<P01> > FBase; - + template<class R2,class Q01> - Function(Function<R2(Q01)> func) + Function(Function<R2(Q01)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; template<class R,class P01,class P02> - struct Function<R(P01,P02)> + struct Function<R(P01,P02)> : public Functor<R, Seq<P01,P02> > { typedef Functor<R, Seq<P01,P02> > FBase; template<class R2,class Q01, class Q02> - Function(Function<R2(Q01,Q02)> func) + Function(Function<R2(Q01,Q02)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; template<class R,class P01,class P02, class P03> - struct Function<R(P01,P02,P03)> + struct Function<R(P01,P02,P03)> : public Functor<R, Seq<P01,P02,P03> > { typedef Functor<R, Seq<P01,P02,P03> > FBase; template<class R2,class Q01, class Q02,class Q03> - Function(Function<R2(Q01,Q02,Q03)> func) + Function(Function<R2(Q01,Q02,Q03)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; template<class R,class P01,class P02, class P03,class P04> - struct Function<R(P01,P02,P03,P04)> + struct Function<R(P01,P02,P03,P04)> : public Functor<R, Seq<P01,P02,P03,P04> > { typedef Functor<R, Seq<P01,P02,P03,P04> > FBase; template<class R2,class Q01,class Q02, class Q03,class Q04> - Function(Function<R2(Q01,Q02,Q03,Q04)> func) + Function(Function<R2(Q01,Q02,Q03,Q04)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; template<class R,class P01,class P02, class P03,class P04,class P05> - struct Function<R(P01,P02,P03,P04,P05)> + struct Function<R(P01,P02,P03,P04,P05)> : public Functor<R, Seq<P01,P02,P03,P04,P05> > { typedef Functor<R, Seq<P01,P02,P03,P04,P05> > FBase; template<class R2,class Q01,class Q02, class Q03,class Q04,class Q05> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05)> func) + Function(Function<R2(Q01,Q02,Q03,Q04,Q05)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY @@ -210,14 +223,14 @@ template<class R, class P01,class P02, class P03,class P04,class P05, class P06> - struct Function<R(P01,P02,P03,P04,P05,P06)> + struct Function<R(P01,P02,P03,P04,P05,P06)> : public Functor<R, Seq<P01,P02,P03,P04,P05,P06> > { typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06> > FBase; - + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, class Q06> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06)> func) + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY @@ -225,14 +238,14 @@ template<class R, class P01,class P02, class P03,class P04,class P05, class P06,class P07> - struct Function<R(P01,P02,P03,P04,P05,P06,P07)> + struct Function<R(P01,P02,P03,P04,P05,P06,P07)> : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07> > { typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07> > FBase; template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, class Q06,class Q07> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07)> func) + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY @@ -240,14 +253,14 @@ template<class R, class P01,class P02, class P03,class P04,class P05, class P06,class P07, class P08> - struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08)> + struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08)> : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08> > { typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08> > FBase; - + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, class Q06,class Q07, class Q08> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08)> func) + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY @@ -255,14 +268,14 @@ template<class R, class P01,class P02, class P03,class P04,class P05, class P06,class P07, class P08,class P09> - struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09)> + struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09)> : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09> > { typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09 > > FBase; - + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, class Q06,class Q07, class Q08,class Q09> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09)> func) + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY @@ -270,14 +283,14 @@ template<class R, class P01,class P02, class P03,class P04,class P05, class P06,class P07, class P08,class P09,class P10> - struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10)> + struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10)> : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10> > { typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10> > FBase; - + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, class Q06,class Q07, class Q08,class Q09,class Q10> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10)> func) + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY @@ -286,15 +299,15 @@ template<class R, class P01,class P02, class P03,class P04,class P05, class P06,class P07, class P08,class P09,class P10, class P11> - struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11)> + struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11)> : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11> > { typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11> >FBase; - + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, class Q06,class Q07, class Q08,class Q09,class Q10, class Q11> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11)> func) + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY @@ -303,15 +316,15 @@ template<class R, class P01,class P02, class P03,class P04,class P05, class P06,class P07, class P08,class P09,class P10, class P11,class P12> - struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12)> + struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12)> : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12> > { typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12> > FBase; - + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, class Q06,class Q07, class Q08,class Q09,class Q10, class Q11,class Q12> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12)> func) + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY @@ -320,15 +333,15 @@ template<class R, class P01,class P02, class P03,class P04,class P05, class P06,class P07, class P08,class P09,class P10, class P11,class P12, class P13> - struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13)> + struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13)> : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13> > { typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13> > FBase; - + template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, class Q06,class Q07, class Q08,class Q09,class Q10, class Q11,class Q12, class Q13> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13)> func) + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY @@ -337,14 +350,14 @@ template<class R, class P01,class P02, class P03,class P04,class P05, class P06,class P07, class P08,class P09,class P10, class P11,class P12, class P13,class P14> - struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14)> + struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14)> : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14> > { typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14> > FBase; template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, class Q06,class Q07, class Q08,class Q09,class Q10, class Q11,class Q12, class Q13,class Q14> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13,Q14)> func) + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13,Q14)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY @@ -353,7 +366,7 @@ template<class R, class P01,class P02, class P03,class P04,class P05, class P06,class P07, class P08,class P09,class P10, class P11,class P12, class P13,class P14,class P15> - struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14,P15)> + struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14,P15)> : public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14,P15> > { typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14,P15> > FBase; @@ -361,7 +374,7 @@ template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, class Q06,class Q07, class Q08,class Q09,class Q10, class Q11,class Q12, class Q13,class Q14,class Q15> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13,Q14,Q15)> func) + Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13,Q14,Q15)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY Modified: trunk/include/loki/Functor.h =================================================================== --- trunk/include/loki/Functor.h 2011-09-21 23:24:54 UTC (rev 1114) +++ trunk/include/loki/Functor.h 2011-09-23 00:46:21 UTC (rev 1115) @@ -2,15 +2,28 @@ // The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: -// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design +// 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 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 for any purpose. It is provided "as is" -// without express or implied warranty. +// +// Code covered by the MIT License +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. //////////////////////////////////////////////////////////////////////////////// #ifndef LOKI_FUNCTOR_INC_ #define LOKI_FUNCTOR_INC_ @@ -48,7 +61,7 @@ namespace Private { template <typename R, template <class, class> class ThreadingModel> - struct FunctorImplBase + struct FunctorImplBase #ifdef LOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT { #else @@ -98,12 +111,12 @@ #ifdef LOKI_FUNCTORS_ARE_COMPARABLE virtual bool operator==(const FunctorImplBase&) const = 0; - -#endif - + +#endif + }; } - + //////////////////////////////////////////////////////////////////////////////// // macro LOKI_DEFINE_CLONE_FUNCTORIMPL // Implements the DoClone function for a functor implementation @@ -121,7 +134,7 @@ // Specializations of FunctorImpl for up to 15 parameters follow //////////////////////////////////////////////////////////////////////////////// - template <typename R, class TList, + template <typename R, class TList, template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL> class FunctorImpl; @@ -159,7 +172,7 @@ // Specialization for 2 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, + template <typename R, typename P1, typename P2, template <class, class> class ThreadingModel> class FunctorImpl<R, Seq<P1, P2>, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel> @@ -271,7 +284,7 @@ typedef typename TypeTraits<P5>::ParameterType Parm5; typedef typename TypeTraits<P6>::ParameterType Parm6; typedef typename TypeTraits<P7>::ParameterType Parm7; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7) = 0; }; @@ -297,7 +310,7 @@ typedef typename TypeTraits<P6>::ParameterType Parm6; typedef typename TypeTraits<P7>::ParameterType Parm7; typedef typename TypeTraits<P8>::ParameterType Parm8; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8) = 0; }; @@ -324,7 +337,7 @@ typedef typename TypeTraits<P7>::ParameterType Parm7; typedef typename TypeTraits<P8>::ParameterType Parm8; typedef typename TypeTraits<P9>::ParameterType Parm9; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8, Parm9) = 0; }; @@ -353,7 +366,7 @@ typedef typename TypeTraits<P8>::ParameterType Parm8; typedef typename TypeTraits<P9>::ParameterType Parm9; typedef typename TypeTraits<P10>::ParameterType Parm10; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8, Parm9, Parm10) = 0; }; @@ -384,7 +397,7 @@ typedef typename TypeTraits<P9>::ParameterType Parm9; typedef typename TypeTraits<P10>::ParameterType Parm10; typedef typename TypeTraits<P11>::ParameterType Parm11; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8, Parm9, Parm10, Parm11) = 0; }; @@ -416,7 +429,7 @@ typedef typename TypeTraits<P10>::ParameterType Parm10; typedef typename TypeTraits<P11>::ParameterType Parm11; typedef typename TypeTraits<P12>::ParameterType Parm12; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8, Parm9, Parm10, Parm11, Parm12) = 0; }; @@ -449,7 +462,7 @@ typedef typename TypeTraits<P11>::ParameterType Parm11; typedef typename TypeTraits<P12>::ParameterType Parm12; typedef typename TypeTraits<P13>::ParameterType Parm13; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13) = 0; }; @@ -484,7 +497,7 @@ typedef typename TypeTraits<P12>::ParameterType Parm12; typedef typename TypeTraits<P13>::ParameterType Parm13; typedef typename TypeTraits<P14>::ParameterType Parm14; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13, Parm14) = 0; }; @@ -520,7 +533,7 @@ typedef typename TypeTraits<P13>::ParameterType Parm13; typedef typename TypeTraits<P14>::ParameterType Parm14; typedef typename TypeTraits<P15>::ParameterType Parm15; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13, Parm14, Parm15) = 0; }; @@ -547,7 +560,7 @@ // Specialization for 2 parameters //////////////////////////////////////////////////////////////////////////////// - template <typename R, typename P1, typename P2, + template <typename R, typename P1, typename P2, template <class, class> class ThreadingModel> class FunctorImpl<R, LOKI_TYPELIST_2(P1, P2), ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel> @@ -659,7 +672,7 @@ typedef typename TypeTraits<P5>::ParameterType Parm5; typedef typename TypeTraits<P6>::ParameterType Parm6; typedef typename TypeTraits<P7>::ParameterType Parm7; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7) = 0; }; @@ -685,7 +698,7 @@ typedef typename TypeTraits<P6>::ParameterType Parm6; typedef typename TypeTraits<P7>::ParameterType Parm7; typedef typename TypeTraits<P8>::ParameterType Parm8; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8) = 0; }; @@ -712,7 +725,7 @@ typedef typename TypeTraits<P7>::ParameterType Parm7; typedef typename TypeTraits<P8>::ParameterType Parm8; typedef typename TypeTraits<P9>::ParameterType Parm9; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8, Parm9) = 0; }; @@ -741,7 +754,7 @@ typedef typename TypeTraits<P8>::ParameterType Parm8; typedef typename TypeTraits<P9>::ParameterType Parm9; typedef typename TypeTraits<P10>::ParameterType Parm10; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8, Parm9, Parm10) = 0; }; @@ -772,7 +785,7 @@ typedef typename TypeTraits<P9>::ParameterType Parm9; typedef typename TypeTraits<P10>::ParameterType Parm10; typedef typename TypeTraits<P11>::ParameterType Parm11; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8, Parm9, Parm10, Parm11) = 0; }; @@ -804,7 +817,7 @@ typedef typename TypeTraits<P10>::ParameterType Parm10; typedef typename TypeTraits<P11>::ParameterType Parm11; typedef typename TypeTraits<P12>::ParameterType Parm12; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8, Parm9, Parm10, Parm11, Parm12) = 0; }; @@ -837,7 +850,7 @@ typedef typename TypeTraits<P11>::ParameterType Parm11; typedef typename TypeTraits<P12>::ParameterType Parm12; typedef typename TypeTraits<P13>::ParameterType Parm13; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13) = 0; }; @@ -872,7 +885,7 @@ typedef typename TypeTraits<P12>::ParameterType Parm12; typedef typename TypeTraits<P13>::ParameterType Parm13; typedef typename TypeTraits<P14>::ParameterType Parm14; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13, Parm14) = 0; }; @@ -908,7 +921,7 @@ typedef typename TypeTraits<P13>::ParameterType Parm13; typedef typename TypeTraits<P14>::ParameterType Parm14; typedef typename TypeTraits<P15>::ParameterType Parm15; - virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, + virtual R operator()(Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8, Parm9, Parm10, Parm11, Parm12, Parm13, Parm14, Parm15) = 0; }; @@ -943,9 +956,9 @@ typedef typename Base::Parm13 Parm13; typedef typename Base::Parm14 Parm14; typedef typename Base::Parm15 Parm15; - + FunctorHandler(const Fun& fun) : f_(fun) {} - + LOKI_DEFINE_CLONE_FUNCTORIMPL(FunctorHandler) @@ -954,7 +967,7 @@ bool operator==(const typename Base::FunctorImplBaseType& rhs) const { - // there is no static information if Functor holds a member function + // there is no static information if Functor holds a member function // or a free function; this is the main difference to tr1::function if(typeid(*this) != typeid(rhs)) return false; // cannot be equal @@ -966,79 +979,79 @@ } #endif // operator() implementations for up to 15 arguments - + ResultType operator()() { return f_(); } ResultType operator()(Parm1 p1) { return f_(p1); } - + ResultType operator()(Parm1 p1, Parm2 p2) { return f_(p1, p2); } - + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3) { return f_(p1, p2, p3); } - + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) { return f_(p1, p2, p3, p4); } - + ResultType operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4,... [truncated message content] |