Make variant constructor from std::shared_ptr a template
For some reason, when the variant constructor only accepts std::shared_ptr<const variant_callable>, MSVC2013 gets confused about which constructor it should call when it has, say, std::shared_ptr<ai::attack_analysis>. Making the constructor a template fixes it.
This commit is contained in:
parent
d536d6ab76
commit
0b02ba0876
2 changed files with 7 additions and 7 deletions
|
@ -162,12 +162,6 @@ variant::variant(double n, variant::DECIMAL_VARIANT_TYPE)
|
|||
assert(value_.get());
|
||||
}
|
||||
|
||||
variant::variant(const_formula_callable_ptr callable)
|
||||
: value_(std::make_shared<variant_callable>(callable))
|
||||
{
|
||||
assert(value_.get());
|
||||
}
|
||||
|
||||
variant::variant(const std::vector<variant>& vec)
|
||||
: value_((std::make_shared<variant_list>(vec)))
|
||||
{
|
||||
|
|
|
@ -34,11 +34,17 @@ public:
|
|||
explicit variant(int n);
|
||||
variant(int n, DECIMAL_VARIANT_TYPE /*type*/);
|
||||
variant(double n, DECIMAL_VARIANT_TYPE /*type*/);
|
||||
variant(const_formula_callable_ptr callable);
|
||||
explicit variant(const std::vector<variant>& array);
|
||||
explicit variant(const std::string& str);
|
||||
explicit variant(const std::map<variant, variant>& map);
|
||||
|
||||
template<typename T>
|
||||
variant(std::shared_ptr<T> callable)
|
||||
: value_(std::make_shared<variant_callable>(callable))
|
||||
{
|
||||
assert(value_.get());
|
||||
}
|
||||
|
||||
variant& operator=(const variant& v);
|
||||
|
||||
variant operator[](size_t n) const;
|
||||
|
|
Loading…
Add table
Reference in a new issue