<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Throw struct 2669]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich sehe gerade wahrscheinlich den Wald vor lauter Bäumen nicht mehr.<br />
Ich habe folgendes Stück Code:</p>
<pre><code>struct wexception : virtual exception
{
	explicit wexception(const wchar_t* msg)	: exception(converter.to_bytes(msg).c_str())
	{
		//exception(converter.to_bytes(msg).c_str());
	}

	wstring what_utf8()
	{
		return converter.from_bytes(what());
	}

private:
	wstring_convert&lt;codecvt_utf8_utf16&lt;wchar_t&gt;&gt; converter;
};

....

try
{
	throw wexception(L&quot;&quot;); //Hier ist der C2280
}
catch(wexception &amp;wex)
{

}
</code></pre>
<p>Fehler:<br />
Schweregrad Code Beschreibung Projekt Datei Zeile Unterdrückungszustand<br />
Fehler C2280 'wexception::wexception(const wexception &amp;)': attempting to reference a deleted function</p>
<p>Soll ja also heißen, dass die Struktur nicht mehr da sein könnte wenn ich aus dem try Block fliege richtig?<br />
Mache ich eine Klasse aus meiner Abgeleiteten' und setz beim throw ein new davor, dann schreit mein ReSharper &quot;﻿Some control paths may leak this resource acquisition&quot;.<br />
Ich denke mal die meinen damit, dass ich im catch ein delete machen müsste?! Aber das macht mit einer normales exception doch auch keine Sau(?).</p>
<p>Wie könnte ich das hier best practice umsetzen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/338535/throw-struct-2669</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 13:22:10 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/338535.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 22 Jun 2016 11:26:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Throw struct 2669 on Wed, 22 Jun 2016 11:26:53 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich sehe gerade wahrscheinlich den Wald vor lauter Bäumen nicht mehr.<br />
Ich habe folgendes Stück Code:</p>
<pre><code>struct wexception : virtual exception
{
	explicit wexception(const wchar_t* msg)	: exception(converter.to_bytes(msg).c_str())
	{
		//exception(converter.to_bytes(msg).c_str());
	}

	wstring what_utf8()
	{
		return converter.from_bytes(what());
	}

private:
	wstring_convert&lt;codecvt_utf8_utf16&lt;wchar_t&gt;&gt; converter;
};

....

try
{
	throw wexception(L&quot;&quot;); //Hier ist der C2280
}
catch(wexception &amp;wex)
{

}
</code></pre>
<p>Fehler:<br />
Schweregrad Code Beschreibung Projekt Datei Zeile Unterdrückungszustand<br />
Fehler C2280 'wexception::wexception(const wexception &amp;)': attempting to reference a deleted function</p>
<p>Soll ja also heißen, dass die Struktur nicht mehr da sein könnte wenn ich aus dem try Block fliege richtig?<br />
Mache ich eine Klasse aus meiner Abgeleiteten' und setz beim throw ein new davor, dann schreit mein ReSharper &quot;﻿Some control paths may leak this resource acquisition&quot;.<br />
Ich denke mal die meinen damit, dass ich im catch ein delete machen müsste?! Aber das macht mit einer normales exception doch auch keine Sau(?).</p>
<p>Wie könnte ich das hier best practice umsetzen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2499746</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2499746</guid><dc:creator><![CDATA[secondsun]]></dc:creator><pubDate>Wed, 22 Jun 2016 11:26:53 GMT</pubDate></item><item><title><![CDATA[Reply to Throw struct 2669 on Wed, 22 Jun 2016 11:51:46 GMT]]></title><description><![CDATA[<p>Das Problem ist einfach, dass exception 2 Konstruktoren hat: einen ohne Parameter und einen Copy-Construktor, der somit eine exception als Parameter bekommen muss.</p>
<p>Du übergibst aber ein <code>const char*</code> - das passt nicht.</p>
<p>Siehe <a href="http://www.cplusplus.com/reference/exception/exception/exception/" rel="nofollow">http://www.cplusplus.com/reference/exception/exception/exception/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2499749</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2499749</guid><dc:creator><![CDATA[wob]]></dc:creator><pubDate>Wed, 22 Jun 2016 11:51:46 GMT</pubDate></item><item><title><![CDATA[Reply to Throw struct 2669 on Wed, 22 Jun 2016 11:53:58 GMT]]></title><description><![CDATA[<p>Siehe <a href="http://wg21.link/lwg2176" rel="nofollow">LWG 2176</a>. <code>wstring_convert&lt;…&gt;</code> ist seit C++14 weder kopier- noch moveable. Ich verstehe auch nicht, warum du von <code>exception</code> ableitest.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2499750</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2499750</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Wed, 22 Jun 2016 11:53:58 GMT</pubDate></item><item><title><![CDATA[Reply to Throw struct 2669 on Wed, 22 Jun 2016 11:54:42 GMT]]></title><description><![CDATA[<p>wob schrieb:</p>
<blockquote>
<p>Das Problem ist einfach, dass exception 2 Konstruktoren hat: einen ohne Parameter und einen Copy-Construktor, der somit eine exception als Parameter bekommen muss.</p>
</blockquote>
<p>Lies doch mal die Fehlermeldung. Er hat offensichtlich eine eigene <code>exception</code> Klasse definiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2499751</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2499751</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Wed, 22 Jun 2016 11:54:42 GMT</pubDate></item></channel></rss>