Chris@49: // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) Chris@49: // Copyright (C) 2008-2013 Conrad Sanderson Chris@49: // Chris@49: // This Source Code Form is subject to the terms of the Mozilla Public Chris@49: // License, v. 2.0. If a copy of the MPL was not distributed with this Chris@49: // file, You can obtain one at http://mozilla.org/MPL/2.0/. Chris@49: Chris@49: Chris@49: //! \addtogroup access Chris@49: //! @{ Chris@49: Chris@49: Chris@49: class access Chris@49: { Chris@49: public: Chris@49: Chris@49: //! internal function to allow modification of data declared as read-only (use with caution) Chris@49: template arma_inline static T1& rw (const T1& x) { return const_cast(x); } Chris@49: template arma_inline static T1*& rwp(const T1* const& x) { return const_cast(x); } Chris@49: Chris@49: //! internal function to obtain the real part of either a plain number or a complex number Chris@49: template arma_inline static const eT& tmp_real(const eT& X) { return X; } Chris@49: template arma_inline static const T tmp_real(const std::complex& X) { return X.real(); } Chris@49: Chris@49: //! internal function to work around braindead compilers Chris@49: template arma_inline static const typename enable_if2::value, const eT&>::result alt_conj(const eT& X) { return X; } Chris@49: template arma_inline static const typename enable_if2< is_complex::value, const eT >::result alt_conj(const eT& X) { return std::conj(X); } Chris@49: }; Chris@49: Chris@49: Chris@49: //! @}