Skip to content

Bug in get_back_reference #4

@jazzvaz

Description

@jazzvaz

При использовании get_back_reference код выдает ошибку в райнтайме. Замена на код ниже (разбить на доп функцию), решило проблему.

	template<class T>
	wrap_base const* get_back_reference_aux(T const* p)
	{
		if constexpr (std::is_polymorphic_v<T>)
		{
			return dynamic_cast<wrap_base const*>(p);
		}

		return nullptr;
	}

	template<class T>
	wrap_base const* get_back_reference(T const& x)
	{
		if constexpr (has_get_pointer_v<T>)
			return get_back_reference_aux(get_pointer(x));
		else
			return get_back_reference_aux(&x);
	}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions