On Mon, Oct 2, 2017 at 12:19 PM David Kimura wrote:
> The other question though is, could function overload resolution be a valid
> use case for out variables (particularly in PdxReader, for example)?
I am against exceptions to rules unless the exception is more readable. In
this case I don't t
I agree. I think returning tuple flows better and seems to be the way the
language is progressing.
Also, I think it's probably even more efficient than using out variable.
Using out variable we'd pay the cost of the default constructor and then
the cost populating any state which is essentially eq
Basic docs on the C++11 tuple use for multiple return types:
http://en.cppreference.com/w/cpp/utility/tuple
In C++11 we would have:
std::tuple foo::getAAndB() {...}
And call it with:
int a;
std::string b;
std::tie(a, b) = foo.getAAndB();
While this isn't super pretty I would argue it is more r
We are already in contention with our style guide on many items. I suggest
we use it as a guideline only and establish our own rules. The more
research into the Google C++ guide is really driven by legacy C/C++ issues
at Google.
Regarding the in/out issue I am for multiple return types so that we
I forgot to mention, and it's probably worth noting, that passing non-const
ref knowingly defies our style-guide.
https://google.github.io/styleguide/cppguide.html#Reference_Arguments
Thanks,
David
On Wed, Sep 27, 2017 at 12:32 PM, Ernest Burghardt
wrote:
> Currently we have a mix of the count
Currently we have a mix of the counter argument...
we use return values and you have to call the explicitly named methods:
double* readDoubleArray(const char* fieldName, int32_t& length)
int64_t* readLongArray(const char* fieldName, int32_t& length)
I'm good with non-const refs in-out to the spec
I like the idea of using non-const references for in-out parameters only and
using tuples for the cases where there are multiple out parameters. Yes, the
return type does not participate in overload resolution but I don't think there
would be many cases where that would be an issue. (But I haven
Is there a use case in our C++ client code to ever use out parameters?
Currently code uses out parameters to return multiple values from a
function. [1]
virtual int64_t* PdxReader::readLongArray(const char* fieldName, int32_t&
length) = 0;
In this case, we could return a tuple instead. I thin