taocpp / operators Goto Github PK
View Code? Open in Web Editor NEWA highly efficient, move-aware operators library
License: MIT License
A highly efficient, move-aware operators library
License: MIT License
The noexcept-specification needs to instantiate the type parameter being used, thus the instance of Template<S>
is generally ill-formed to be used in base-specifier-list of definition of S
. Because before the closing }
of the definition of S
, S
is an incomplete type, so the operand in noexcept-specification in member declarations of instantiated Template<S>
definition is ill-formed. This problem does not occur in boost.operators.
(Clang++ and G++ may differ here. Though the diagnostics of Clang++ is awful, it should be right.)
I don't think there is a constexpr version of the methods provided in operators.h, would you be interested in one? I'm wondering if this could be done by having on .h define something and include the operator.h header. The super clean, but the benefit would be that working in one file would implement the solution for both, what do you think?
Both arch and compiler are required by Conan to use CMake helper with MSVC. This rule will be relaxed on Conan 1.5.0.
We need to wait the next release to make this change.
Related discussion: conan-io/conan#3011
... operator<=(lhs, rhs) {
return (rhs >= lhs); // <---- wrong, should be: !(rhs < lhs)
}
... operator>=(lhs, rhs) {
return (rhs <= lhs); // <---- wrong, should be: !(rhs > lhs)
}
Have you considered adding constexpr
support to this great library? Unfortunately, it can't be done with the current approach (see foonathan/type_safe#36).
Greetings,
Johel
Like other taocpp libraries, this one needs CI to prevent typos, etc.
When trying an example with my template class I get the following errors. The class MathVec had been pre-declared before this definition.
tao\operators.hpp(480): error : incomplete type is not allowed
1> TAO_OPERATORS_BASIC_OP( addable, +);
template
class MathVec : public VecView, tao::operators::addable< MathVec >
{
public:
....
}
I am a bit puzzled at the moment:
struct Foo1 : public tao::operators::less_than_comparable<Foo1>
{
int i;
bool operator==(const Foo1 &rhs) const { return i == rhs.i; }
bool operator<(const Foo1 &rhs) const { return i < rhs.i; }
};
struct Foo2 : public tao::operators::equality_comparable<Foo2>
{
int i;
bool operator==(const Foo2 &rhs) const { return i == rhs.i; }
bool operator<(const Foo2 &rhs) const { return i < rhs.i; }
};
struct Foo3 : public tao::operators::totally_ordered<Foo3>
{
int i;
bool operator==(const Foo3 &rhs) const { return i == rhs.i; }
bool operator<(const Foo3 &rhs) const { return i < rhs.i; }
};
static_assert(sizeof(Foo1) == sizeof(int), "expected Foo1 to be the same size as a int");
static_assert(sizeof(Foo2) == sizeof(int), "expected Foo2 to be the same size as a int");
static_assert(sizeof(Foo3) == sizeof(int), "expected Foo3 to be the same size as a int");
Tested with msvc2015, this asserts on the third one:
error C2338: expected Foo3 to be the same size as a int
I don't think it is expected behaviour to increase the size of the implemented type and it seems related to the fact that totally_ordered
has double inheritance.
I'm looking at this project as I have a good use for it. I'm not seeing one thing though. It seems to me that cumulatively addable an addable have the same results and requirements. That is I'm not seeing any difference between them.
My interest is in using a + b as the requirement so that I can use with types which don't support the += operator. That is immutable types.
Thanks in advance
Robert Ramey
PS Have you considered adding this to the Boost Library Incubator?
Placeholder, to be closed once I explain in the README why rvalue references are returned from some operators and what this means for the user.
What?
Provide support on Travis and Appveyor to build Conan package
Why?
For now it's only possible to validate Conan package by standalone build
How?
Sometimes it is intended to pass the parameters by value rather than by reference. For example, to use with an odr-used object of literal type which is declared with constexpr
but without a definition. If it is passed by reference, lvalue-to-rvalue conversion makes it odr-used, and the definition is needed to meet the One Definition Rule. Can this be configured by template arguments?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.