Git Product home page Git Product logo

operators's People

Contributors

arookas avatar colinh avatar d-frey avatar kirbyfan64 avatar uilianries avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

operators's Issues

Incomplete types

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.)

constexpr version of operator.h

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?

bug in less_than_comparable

... operator<=(lhs, rhs) {
  return (rhs >= lhs); // <---- wrong, should be: !(rhs < lhs)
}
... operator>=(lhs, rhs) {
  return (rhs <= lhs); // <---- wrong, should be: !(rhs > lhs)
}

Add tests, CI

Like other taocpp libraries, this one needs CI to prevent typos, etc.

incomplete type is not allowed error with Intel 19.1 compiler

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:
....
}

totally_ordered increases the size of the type (tested msvc2015)

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.

cumulatively addable vs addable

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?

Build Conan on CI

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?

  • Use Conan package tools to execute all jobs
  • Collect the package reference by cmake.
  • Only upload Conan package when create project tag

Call by value vs. call by reference

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.