Skip to content

Commit

Permalink
Improve external target visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
eastskykang authored and fdevinc committed Jan 15, 2024
1 parent 6fc909a commit 2f8a537
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
1 change: 1 addition & 0 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ if(UNGAR_ENABLE_LOGGING)
find_package(spdlog REQUIRED)
endif()
set_target_properties(spdlog::spdlog PROPERTIES IMPORTED_GLOBAL TRUE)
set_target_properties(spdlog::spdlog_header_only PROPERTIES IMPORTED_GLOBAL TRUE)

if(DEFINED SPDLOG_ROOT_DIRECTORY)
message(STATUS "spdlog found at '${SPDLOG_ROOT_DIRECTORY}'.")
Expand Down
19 changes: 6 additions & 13 deletions include/ungar/variable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,7 @@ class Variable {
* @return New "branch" variable with an additional sub-variable in the
* corresponding hierarchy.
*/
constexpr auto operator<<=(Concepts::Variable auto var) const
requires(IsBranch())
{
constexpr auto operator<<=(Concepts::Variable auto var) const requires(IsBranch()) {
auto map = hana::insert(
_map, hana::make_pair(var.Name(), var.CloneWithIndexOffset(Index() + SizeC())));
return Make(Name(), map, Index(), 0_c);
Expand All @@ -240,8 +238,7 @@ class Variable {
* sub-variables in the corresponding hierarchy.
*/
constexpr auto operator<<=(Concepts::VariableProductExpr auto prodExpr) const
requires(IsBranch())
{
requires(IsBranch()) {
auto array = hana::unpack(hana::make_range(0_c, prodExpr.cnt), [&](auto... is) {
return std::array{prodExpr.var.CloneWithIndexOffset(Index() + SizeC() +
prodExpr.var.SizeC() * is)...};
Expand All @@ -263,9 +260,7 @@ class Variable {
* array of identical sub-variables for each element in the input
* tuple.
*/
constexpr auto operator<<=(Concepts::HanaTuple auto tuple) const
requires(IsBranch())
{
constexpr auto operator<<=(Concepts::HanaTuple auto tuple) const requires(IsBranch()) {
auto lambda = [&](auto var, auto el) { return var <<= el; };
return hana::fold(tuple, *this, lambda);
}
Expand All @@ -276,8 +271,7 @@ class Variable {
*/
template <Concepts::HanaString _N>
constexpr const auto& Get(_N name) const
requires(hana::contains(hana::keys(_Map{}), _N{}).value)
{
requires(hana::contains(hana::keys(_Map{}), _N{}).value) {
if constexpr (!is_std_array_v<std::remove_cvref_t<decltype(DefaultMap()[_N{}])>>) {
return _map[name];
} else {
Expand Down Expand Up @@ -379,8 +373,7 @@ class Variable {
* or \c At member functions).
*/
constexpr const auto& Get(auto key, auto... args) const
requires(hana::contains(hana::keys(_Map{}), decltype(key)::Name()).value)
{
requires(hana::contains(hana::keys(_Map{}), decltype(key)::Name()).value) {
return Get(key).Get(args...);
}

Expand Down Expand Up @@ -596,7 +589,7 @@ class Variable {
}

template <Concepts::HanaString _N, Concepts::HanaMap _M, Concepts::HanaIntegralConstant _S>
static constexpr auto Make(_N name, _M map, const index_t index, _S size) {
static constexpr auto Make(_N name, _M map, const index_t index, _S /* size */) {
return Variable<_N, _M, _S::value>{name, map, index};
}

Expand Down

0 comments on commit 2f8a537

Please sign in to comment.