tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
enable_if< bool, Type > Struct Template Reference

Define a member typedef only if a boolean constant is true. More...

#include <enable_if.hpp>

Detailed Description

template<bool, typename Type = void>
struct etl::enable_if< bool, Type >

Define a member typedef only if a boolean constant is true.

// SPDX-License-Identifier: BSL-1.0
// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
#if defined(TETL_ENABLE_CXX_MODULES)
import etl;
#else
#include <etl/cstdint.hpp>
#endif
namespace {
template <typename T>
auto func(T val) -> int
{
return static_cast<int>(val);
}
auto func(float val) -> float
{
return val;
}
} // namespace
auto main() -> int
{
func(42); // Calls template
func(etl::uint16_t{1}); // Calls template
func(3.0F); // Does not call template
return 0;
}
TETL_BUILTIN_UINT16 uint16_t
Unsigned integer type with width of exactly 16 bits.
Definition uint_t.hpp:15
The class template bitset represents a fixed-size sequence of Bits bits. Bitsets can be manipulated b...
Definition bitset.hpp:23

The documentation for this struct was generated from the following file: