CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
as_const.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Util
4
5Author: Romain Brenguier, romain.brenguier@diffblue.com
6
7\*******************************************************************/
8
9#ifndef CPROVER_UTIL_AS_CONST_H
10#define CPROVER_UTIL_AS_CONST_H
11
13template <typename T>
14const T &as_const(T &value)
15{
16 return static_cast<const T &>(value);
17}
18
20template <typename T>
21const T *as_const_ptr(T *t)
22{
23 return t;
24}
25
27template <typename T>
28void as_const(T &&) = delete;
29
30#endif // CPROVER_UTIL_AS_CONST_H
const T * as_const_ptr(T *t)
Return a pointer to the same object but ensures the type is pointer to const.
Definition as_const.h:21
const T & as_const(T &value)
Return a reference to the same object but ensures the type is const.
Definition as_const.h:14