Gromacs
2025-dev-20240910-a7e2421
|
Provides ported functions/classes from gsl/pointers.
Adapted from the Guidelines Support Library v2.0.0. at https://github.com/Microsoft/GSL
In the community spirit, you can opt to distribute this file, including our modifications, under the original MIT license instead of LGPL v2.1 (that GROMACS is licensed under):
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
This code is licensed under the MIT License (MIT).
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.
Classes | |
class | gmx::compat::not_null< T > |
Restricts a pointer or smart pointer to only hold non-null values. More... | |
Macros | |
#define | Expects(cond) GMX_ASSERT((cond), "Precondition violation") |
Contract-assurance macros that work like a simple version of the GSL ones. | |
#define | Ensures(cond) GMX_ASSERT((cond), "Postcondition violation") |
Functions | |
template<class T > | |
not_null< T > | gmx::compat::make_not_null (T &&t) |
Convenience function for making not_null pointers from plain pointers. | |
template<class T > | |
not_null< typename T::pointer > | gmx::compat::make_not_null (T &t) |
Convenience function for making not_null pointers from smart pointers. | |
template<class T , class U > | |
auto | gmx::compat::operator== (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get()==rhs.get()) |
Operators to compare not_null pointers. | |
template<class T , class U > | |
auto | gmx::compat::operator!= (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get()!=rhs.get()) |
template<class T , class U > | |
auto | gmx::compat::operator< (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get()< rhs.get()) |
template<class T , class U > | |
auto | gmx::compat::operator<= (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get()<=rhs.get()) |
template<class T , class U > | |
auto | gmx::compat::operator> (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get() > rhs.get()) |
template<class T , class U > | |
auto | gmx::compat::operator>= (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get() >=rhs.get()) |
template<class T , class U > | |
std::ptrdiff_t | gmx::compat::operator- (const not_null< T > &, const not_null< U > &)=delete |
Deleted unwanted arithmetic operators. | |
template<class T > | |
not_null< T > | gmx::compat::operator- (const not_null< T > &, std::ptrdiff_t)=delete |
template<class T > | |
not_null< T > | gmx::compat::operator+ (const not_null< T > &, std::ptrdiff_t)=delete |
template<class T > | |
not_null< T > | gmx::compat::operator+ (std::ptrdiff_t, const not_null< T > &)=delete |