Skip to content
Snippets Groups Projects
Commit c946134d authored by Oliver Sander's avatar Oliver Sander
Browse files

Remove operator[] with integral_constant<int,...>

The dune-common module now contains short-cuts for static indices of type
integral_constant<size_t,...>, and we should try to standardize on those.
parent cb06799d
No related branches found
No related tags found
No related merge requests found
......@@ -218,30 +218,6 @@ namespace Dune {
return FirstRow::size();
}
/** \brief Random-access operator
*
* This method mimicks the behavior of normal vector access with square brackets like, e.g., m[5] = ....
* The problem is that the return type is different for each value of the argument in the brackets.
* Therefore we implement a trick using std::integral_constant. To access the first row of
* a MultiTypeBlockMatrix named m write
* \code
* std::integral_constant<int,0> _0;
* m[_0] = ...
* \endcode
* The name '_0' used here as a static replacement of the integer number zero is arbitrary.
* Any other variable name can be used. If you don't like the separate variable, you can write
* \code
* m[std::integral_constant<int,0>()] = ...
* \endcode
*/
template< int index >
auto
operator[] ( const std::integral_constant< int, index > indexVariable ) -> decltype(std::get<index>(*this))
{
DUNE_UNUSED_PARAMETER(indexVariable);
return std::get<index>(*this);
}
/** \brief Random-access operator
*
* This method mimicks the behavior of normal vector access with square brackets like, e.g., m[5] = ....
......@@ -266,19 +242,6 @@ namespace Dune {
return std::get<index>(*this);
}
/** \brief Const random-access operator
*
* This is the const version of the random-access operator. See the non-const version for a full
* explanation of how to use it.
*/
template< int index >
auto
operator[] ( const std::integral_constant< int, index > indexVariable ) const -> decltype(std::get<index>(*this))
{
DUNE_UNUSED_PARAMETER(indexVariable);
return std::get<index>(*this);
}
/** \brief Const random-access operator
*
* This is the const version of the random-access operator. See the non-const version for a full
......
......@@ -331,32 +331,6 @@ namespace Dune {
return sizeof...(Args);
}
/** \brief Random-access operator
*
* This method mimicks the behavior of normal vector access with square brackets like, e.g., v[5] = 1.
* The problem is that the return type is different for each value of the argument in the brackets.
* Therefore we implement a trick using std::integral_constant. To access the first entry of
* a MultiTypeBlockVector named v write
* \code
* MultiTypeBlockVector<A,B,C,D> v;
* std::integral_constant<int,0> _0;
* v[_0] = ...
* \endcode
* The name '_0' used here as a static replacement of the integer number zero is arbitrary.
* Any other variable name can be used. If you don't like the separate variable, you can writee
* \code
* MultiTypeBlockVector<A,B,C,D> v;
* v[std::integral_constant<int,0>()] = ...
* \endcode
*/
template< int index >
typename std::tuple_element<index,tupleType>::type&
operator[] ( const std::integral_constant< int, index > indexVariable )
{
DUNE_UNUSED_PARAMETER(indexVariable);
return std::get<index>(*this);
}
/** \brief Random-access operator
*
* This method mimicks the behavior of normal vector access with square brackets like, e.g., v[5] = 1.
......@@ -396,19 +370,6 @@ namespace Dune {
return std::get<index>(*this);
}
/** \brief Const random-access operator
*
* This is the const version of the random-access operator. See the non-const version for a full
* explanation of how to use it.
*/
template< int index >
const typename std::tuple_element<index,tupleType>::type&
operator[] ( const std::integral_constant< int, index > indexVariable ) const
{
DUNE_UNUSED_PARAMETER(indexVariable);
return std::get<index>(*this);
}
/** \brief Assignment operator
*/
template<typename T>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment