libfoedus-core
FOEDUS Core Library
C++11 Keywords in Public Headers

Defines macros for hiding C++11 features in public headers for clients that use C++98. More...

Detailed Description

Defines macros for hiding C++11 features in public headers for clients that use C++98.

C++11 in libfoedus
We basically do assume C++11 and our library provides the best flexibility when the client program enables C++11. For example, the client program can simply contain foedus-core as a subfolder and statically link to it if C++11 is enabled. However, some client program might have to stick to C++98. In that case, we provide our library as an external shared library which comes with public headers that at least compile in C++98. Thus, we will make sure C++11 keywords and classes do not directly appear in public header files. The macros defined in this file are for that switching.
DISABLE_CXX11_IN_PUBLIC_HEADERS macro
This macro is defined if __cplusplus < 201103L, meaning the compiler option for the programs that include this header file (note: which is different from compiler option for libfoedus) disables C++11. If defined, our public headers must hide all C++11 dependent APIs. So, there are several ifdefs on this macro in public headers.
stdint.h vs cstdint
For the same reason, we include stdint.h rather than cstdint. cstdint is a C++11 extension, which defines those integer types in std namespace (eg std::int32_t). The integer types in global namespace are more concise to use, too.
C++11 in cpp and non-public headers
Remember, this is only for public headers. We anyway compile our library with C++11. We can freely use C++11 keywords/features in cpp and non-public header files, such as xxx_impl.hpp, and xxx_pimpl.hpp. In other words, client programs must not include them unless they turn on C++11. Also, impl/pimpl header files often include too much details for client programs to rely on. They might change in next versions.
Collaboration diagram for C++11 Keywords in Public Headers:

Macros

#define CXX11_FUNC_DELETE   = delete
 Used in public headers in place of " = delete" of C++11. More...
 
#define CXX11_FUNC_DEFAULT   = default
 Used in public headers in place of " = default" of C++11. More...
 
#define CXX11_CONSTEXPR   constexpr
 Used in public headers in place of "constexpr" of C++11. More...
 
#define CXX11_FINAL   final
 Used in public headers in place of "final" of C++11. More...
 
#define CXX11_NULLPTR   nullptr
 Used in public headers in place of "nullptr" of C++11. More...
 
#define CXX11_NOEXCEPT   noexcept
 Used in public headers in place of "noexcept" of C++11. More...
 
#define CXX11_OVERRIDE   override
 Used in public headers in place of "override" of C++11. More...
 
#define CXX11_STATIC_ASSERT(expr, message)   static_assert(expr, message)
 Used in public headers in place of "static_assert" of C++11. More...
 

Macro Definition Documentation

#define CXX11_CONSTEXPR   constexpr

Used in public headers in place of "constexpr" of C++11.

Note
C++98 : nothing.

Definition at line 130 of file cxx11.hpp.

#define CXX11_FINAL   final

Used in public headers in place of "final" of C++11.

Note
C++98 : nothing.

Definition at line 131 of file cxx11.hpp.

#define CXX11_FUNC_DEFAULT   = default

Used in public headers in place of " = default" of C++11.

Note
C++98 : nothing.

Definition at line 129 of file cxx11.hpp.

#define CXX11_FUNC_DELETE   = delete

Used in public headers in place of " = delete" of C++11.

Note
C++98 : nothing.

Definition at line 128 of file cxx11.hpp.

#define CXX11_NOEXCEPT   noexcept

Used in public headers in place of "noexcept" of C++11.

Note
C++98 : nothing.

Definition at line 133 of file cxx11.hpp.

#define CXX11_OVERRIDE   override

Used in public headers in place of "override" of C++11.

Note
C++98 : nothing.

Definition at line 134 of file cxx11.hpp.

#define CXX11_STATIC_ASSERT (   expr,
  message 
)    static_assert(expr, message)

Used in public headers in place of "static_assert" of C++11.

Note
C++98 : nothing.

Definition at line 135 of file cxx11.hpp.

Referenced by foedus::assorted::static_size_check().