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