Skip to content

Commit

Permalink
Merge pull request #12222 from uliegecsm/teuchos-remove-old-remove-const
Browse files Browse the repository at this point in the history
teuchos(cleaning): remove old `remove_const_t` trait
  • Loading branch information
bartlettroscoe authored Sep 9, 2023
2 parents 1e1519f + 65353fa commit c3b06cd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 89 deletions.
8 changes: 4 additions & 4 deletions packages/teuchos/core/src/Teuchos_ArrayView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ ArrayView<const T>::ArrayView(const ArrayView<const T>& array)

template<class T> inline
ArrayView<T>::ArrayView(
std::vector<typename ConstTypeTraits<T>::NonConstType>& vec
std::vector<typename std::remove_const_t<T>>& vec
)
: ptr_( vec.empty() ? 0 : vec.data() ), size_(vec.size())
{
Expand All @@ -147,7 +147,7 @@ ArrayView<T>::ArrayView(

template<class T> inline
ArrayView<const T>::ArrayView(
std::vector<typename ConstTypeTraits<T>::NonConstType>& vec
std::vector<typename std::remove_const_t<T>>& vec
)
: ptr_( vec.empty() ? 0 : vec.data() ), size_(vec.size())
{
Expand All @@ -157,7 +157,7 @@ ArrayView<const T>::ArrayView(

template<class T> inline
ArrayView<T>::ArrayView(
const std::vector<typename ConstTypeTraits<T>::NonConstType>& vec
const std::vector<typename std::remove_const_t<T>>& vec
)
: ptr_( vec.empty() ? 0 : vec.data() ), size_(vec.size())
{
Expand All @@ -166,7 +166,7 @@ ArrayView<T>::ArrayView(

template<class T> inline
ArrayView<const T>::ArrayView(
const std::vector<typename ConstTypeTraits<T>::NonConstType>& vec
const std::vector<typename std::remove_const_t<T>>& vec
)
: ptr_( vec.empty() ? 0 : vec.data() ), size_(vec.size())
{
Expand Down
9 changes: 4 additions & 5 deletions packages/teuchos/core/src/Teuchos_ArrayViewDecl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#include "Teuchos_RCPNode.hpp"
#include "Teuchos_ENull.hpp"
#include "Teuchos_NullIteratorTraits.hpp"
#include "Teuchos_ConstTypeTraits.hpp"
#include <vector>

namespace Teuchos {
Expand Down Expand Up @@ -203,10 +202,10 @@ class ArrayView {
ArrayView (const ArrayView<T>& array);

//! Create a nonconst view of an std::vector<T>.
ArrayView (std::vector<typename ConstTypeTraits<T>::NonConstType>& vec);
ArrayView (std::vector<typename std::remove_const_t<T>>& vec);

//! Create a const view of an std::vector<T>.
ArrayView (const std::vector<typename ConstTypeTraits<T>::NonConstType>& vec);
ArrayView (const std::vector<typename std::remove_const_t<T>>& vec);

//! Shallow copy assignment operator.
ArrayView<T>& operator= (const ArrayView<T>& array);
Expand Down Expand Up @@ -456,9 +455,9 @@ class ArrayView<const T> {

ArrayView (const ArrayView<const T>& array);

ArrayView (std::vector<typename ConstTypeTraits<T>::NonConstType>& vec);
ArrayView (std::vector<typename std::remove_const_t<T>>& vec);

ArrayView (const std::vector<typename ConstTypeTraits<T>::NonConstType>& vec);
ArrayView (const std::vector<typename std::remove_const_t<T>>& vec);

ArrayView<const T>& operator= (const ArrayView<const T>& array);

Expand Down
76 changes: 0 additions & 76 deletions packages/teuchos/core/src/Teuchos_ConstTypeTraits.hpp

This file was deleted.

8 changes: 4 additions & 4 deletions packages/teuchos/core/src/Teuchos_TypeNameTraits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -64,6 +62,8 @@

#include <typeinfo>

#include "Teuchos_ConfigDefs.hpp"

namespace Teuchos {


Expand Down Expand Up @@ -114,7 +114,7 @@ class TypeNameTraits {
template<typename T>
std::string typeName( const T &t )
{
typedef typename ConstTypeTraits<T>::NonConstType ncT;
typedef typename std::remove_const_t<T> ncT;
#ifndef TEUCHOS_TYPE_NAME_TRAITS_OLD_IBM
return TypeNameTraits<ncT>::concreteName(t);
#else
Expand All @@ -137,7 +137,7 @@ std::string typeName( const T &t )
template<typename T>
std::string concreteTypeName( const T &t )
{
typedef typename ConstTypeTraits<T>::NonConstType ncT;
typedef typename std::remove_const_t<T> ncT;
return TypeNameTraits<ncT>::concreteName(t);
}

Expand Down

0 comments on commit c3b06cd

Please sign in to comment.