mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-02-02 10:40:38 +01:00
Replace FB_NELEM macro by constexpr function.
This commit is contained in:
parent
8c57b29f1c
commit
1d858667d8
@ -32,6 +32,7 @@
|
|||||||
#ifndef INCLUDE_FB_TYPES_H
|
#ifndef INCLUDE_FB_TYPES_H
|
||||||
#define INCLUDE_FB_TYPES_H
|
#define INCLUDE_FB_TYPES_H
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#if SIZEOF_LONG == 8
|
#if SIZEOF_LONG == 8
|
||||||
@ -132,8 +133,12 @@ vmslock.cpp:LOCK_convert() calls VMS' sys$enq that may require this signature,
|
|||||||
but our code never uses the return value. */
|
but our code never uses the return value. */
|
||||||
typedef int (*lock_ast_t)(void*);
|
typedef int (*lock_ast_t)(void*);
|
||||||
|
|
||||||
/* Number of elements in an array */
|
// Number of elements in an array
|
||||||
#define FB_NELEM(x) ((int)(sizeof(x) / sizeof(x[0])))
|
template <typename T, std::size_t N>
|
||||||
|
constexpr int FB_NELEM(const T (&)[N])
|
||||||
|
{
|
||||||
|
return N;
|
||||||
|
}
|
||||||
|
|
||||||
// Intl types
|
// Intl types
|
||||||
typedef SSHORT CHARSET_ID;
|
typedef SSHORT CHARSET_ID;
|
||||||
|
Loading…
Reference in New Issue
Block a user