Skip to content

Commit 090eb28

Browse files
committed
fixed tamplete specialization for bool
1 parent 2da2731 commit 090eb28

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

include/Blackboard/blackboard.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ class Blackboard
7171
return true;
7272
}
7373

74+
template <typename T> T get(const std::string& key) const
75+
{
76+
T value;
77+
bool found = get(key, value);
78+
if(!found)
79+
{
80+
throw std::runtime_error("Missing key");
81+
}
82+
return value;
83+
}
84+
85+
7486
/// Update the entry with the given key
7587
template <typename T> void set(const std::string& key, const T& value)
7688
{

include/SafeAny/convert_impl.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,14 @@ template<typename SRC,typename DST> inline
177177
typename std::enable_if< !is_convertible_type<DST>::value, void>::type
178178
convertNumber( const SRC& , DST& )
179179
{
180-
throw std::runtime_error("Not convertible");
180+
static_assert(is_convertible_type<DST>::value,"Not convertible");
181+
}
182+
183+
template<typename SRC,typename DST> inline
184+
EnableIf< std::is_same<bool, DST>>
185+
convertNumber( const SRC& from, DST& target )
186+
{
187+
target = (from != 0);
181188
}
182189

183190

0 commit comments

Comments
 (0)