c++ - How to deal with failed constructor when throwing exceptions is not allowed -


I was looking at the Google C ++ style guide and they decided, instead of relying on prices instead of relying.

My question is how do you face failure in the consultants in this matter, because you can not return any value to it.

Thank you!

My first trend would be to take the failure point from the constructor, and create an initialization method.

In this way, you can create your own object without fear of failure, then call the init () function This task can return something like success / failure, for example -1 if Failure occurs.

Yes this is an extra step, but it has been unable to make you a constructor fail


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -