From 65353fafadaf1b8a22daea7edd29b0e08a7a2313 Mon Sep 17 00:00:00 2001 From: uliegecsm Date: Thu, 7 Sep 2023 11:33:10 +0000 Subject: [PATCH] teuchos(cleaning): remove old `remove_const_t` trait --- .../teuchos/core/src/Teuchos_ArrayView.hpp | 8 +- .../core/src/Teuchos_ArrayViewDecl.hpp | 9 +-- .../core/src/Teuchos_ConstTypeTraits.hpp | 76 ------------------- .../core/src/Teuchos_TypeNameTraits.hpp | 8 +- 4 files changed, 12 insertions(+), 89 deletions(-) delete mode 100644 packages/teuchos/core/src/Teuchos_ConstTypeTraits.hpp diff --git a/packages/teuchos/core/src/Teuchos_ArrayView.hpp b/packages/teuchos/core/src/Teuchos_ArrayView.hpp index dd1bd4e51ff4..5c18a303b26c 100644 --- a/packages/teuchos/core/src/Teuchos_ArrayView.hpp +++ b/packages/teuchos/core/src/Teuchos_ArrayView.hpp @@ -138,7 +138,7 @@ ArrayView::ArrayView(const ArrayView& array) template inline ArrayView::ArrayView( - std::vector::NonConstType>& vec + std::vector>& vec ) : ptr_( vec.empty() ? 0 : vec.data() ), size_(vec.size()) { @@ -147,7 +147,7 @@ ArrayView::ArrayView( template inline ArrayView::ArrayView( - std::vector::NonConstType>& vec + std::vector>& vec ) : ptr_( vec.empty() ? 0 : vec.data() ), size_(vec.size()) { @@ -157,7 +157,7 @@ ArrayView::ArrayView( template inline ArrayView::ArrayView( - const std::vector::NonConstType>& vec + const std::vector>& vec ) : ptr_( vec.empty() ? 0 : vec.data() ), size_(vec.size()) { @@ -166,7 +166,7 @@ ArrayView::ArrayView( template inline ArrayView::ArrayView( - const std::vector::NonConstType>& vec + const std::vector>& vec ) : ptr_( vec.empty() ? 0 : vec.data() ), size_(vec.size()) { diff --git a/packages/teuchos/core/src/Teuchos_ArrayViewDecl.hpp b/packages/teuchos/core/src/Teuchos_ArrayViewDecl.hpp index 2872e6aee095..93145e560c05 100644 --- a/packages/teuchos/core/src/Teuchos_ArrayViewDecl.hpp +++ b/packages/teuchos/core/src/Teuchos_ArrayViewDecl.hpp @@ -46,7 +46,6 @@ #include "Teuchos_RCPNode.hpp" #include "Teuchos_ENull.hpp" #include "Teuchos_NullIteratorTraits.hpp" -#include "Teuchos_ConstTypeTraits.hpp" #include namespace Teuchos { @@ -203,10 +202,10 @@ class ArrayView { ArrayView (const ArrayView& array); //! Create a nonconst view of an std::vector. - ArrayView (std::vector::NonConstType>& vec); + ArrayView (std::vector>& vec); //! Create a const view of an std::vector. - ArrayView (const std::vector::NonConstType>& vec); + ArrayView (const std::vector>& vec); //! Shallow copy assignment operator. ArrayView& operator= (const ArrayView& array); @@ -456,9 +455,9 @@ class ArrayView { ArrayView (const ArrayView& array); - ArrayView (std::vector::NonConstType>& vec); + ArrayView (std::vector>& vec); - ArrayView (const std::vector::NonConstType>& vec); + ArrayView (const std::vector>& vec); ArrayView& operator= (const ArrayView& array); diff --git a/packages/teuchos/core/src/Teuchos_ConstTypeTraits.hpp b/packages/teuchos/core/src/Teuchos_ConstTypeTraits.hpp deleted file mode 100644 index 237732563acc..000000000000 --- a/packages/teuchos/core/src/Teuchos_ConstTypeTraits.hpp +++ /dev/null @@ -1,76 +0,0 @@ -// @HEADER -// *********************************************************************** -// -// Teuchos: Common Tools Package -// Copyright (2004) Sandia Corporation -// -// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive -// license for use of this work by or on behalf of the U.S. Government. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Michael A. Heroux (maherou@sandia.gov) -// -// *********************************************************************** -// @HEADER - -#ifndef TEUCHOS_CONST_TYPE_TRAITS_HPP -#define TEUCHOS_CONST_TYPE_TRAITS_HPP - - -#include "Teuchos_ConfigDefs.hpp" - - -namespace Teuchos { - - -/** \brief Traits class that strips 'const' off of a type. - * - * See "Modern C++ Design", 2001, by Andrei Alexandrescu. - * - * \ingroup teuchos_language_support_grp - */ -template -class ConstTypeTraits { -private: - /** \brief . */ - template struct UnConst - { typedef U Result; }; - /** \brief . */ - template struct UnConst - { typedef U Result; }; -public: - /** \brief . */ - typedef typename UnConst::Result NonConstType; -}; - - -} // end namespace Teuchos - - -#endif // TEUCHOS_CONST_TYPE_TRAITS_HPP diff --git a/packages/teuchos/core/src/Teuchos_TypeNameTraits.hpp b/packages/teuchos/core/src/Teuchos_TypeNameTraits.hpp index 5bfd03611fed..bb3e89f9b537 100644 --- a/packages/teuchos/core/src/Teuchos_TypeNameTraits.hpp +++ b/packages/teuchos/core/src/Teuchos_TypeNameTraits.hpp @@ -47,8 +47,6 @@ name of a type in a portable and readable way. */ -#include "Teuchos_ConstTypeTraits.hpp" - // mfh 30 Jan 2013: Thanks to Jim Willenbring for reporting this, and // to Mike Glass and Paul Lin for updating the fix for dealing with a // bug in IBM's XL C++ compiler. The update was necessary due to a @@ -64,6 +62,8 @@ #include +#include "Teuchos_ConfigDefs.hpp" + namespace Teuchos { @@ -114,7 +114,7 @@ class TypeNameTraits { template std::string typeName( const T &t ) { - typedef typename ConstTypeTraits::NonConstType ncT; + typedef typename std::remove_const_t ncT; #ifndef TEUCHOS_TYPE_NAME_TRAITS_OLD_IBM return TypeNameTraits::concreteName(t); #else @@ -137,7 +137,7 @@ std::string typeName( const T &t ) template std::string concreteTypeName( const T &t ) { - typedef typename ConstTypeTraits::NonConstType ncT; + typedef typename std::remove_const_t ncT; return TypeNameTraits::concreteName(t); }