X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fex.h;h=b1e319d9bc47e7fb49e51fe5863625738b6e1aaa;hp=387c04e8b57a2e4f318350c604f0b572b8808855;hb=8a4e28dc81;hpb=761d1597532504762c1f9b438c7727c4f74d7da3 diff --git a/ginac/ex.h b/ginac/ex.h index 387c04e8..b1e319d9 100644 --- a/ginac/ex.h +++ b/ginac/ex.h @@ -3,7 +3,7 @@ * Interface to GiNaC's light-weight expression handles. */ /* - * GiNaC Copyright (C) 1999-2017 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2020 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -87,6 +87,8 @@ public: ex(unsigned int i); ex(long i); ex(unsigned long i); + ex(long long i); + ex(unsigned long long i); ex(double const d); /** Construct ex from string and a list of symbols. The input grammar is @@ -236,6 +238,8 @@ private: static basic & construct_from_uint(unsigned int i); static basic & construct_from_long(long i); static basic & construct_from_ulong(unsigned long i); + static basic & construct_from_longlong(long long i); + static basic & construct_from_ulonglong(unsigned long long i); static basic & construct_from_double(double d); static ptr construct_from_string_and_lst(const std::string &s, const ex &l); void makewriteable(); @@ -290,6 +294,18 @@ ex::ex(unsigned long i) : bp(construct_from_ulong(i)) GINAC_ASSERT(bp->flags & status_flags::dynallocated); } +inline +ex::ex(long long i) : bp(construct_from_longlong(i)) +{ + GINAC_ASSERT(bp->flags & status_flags::dynallocated); +} + +inline +ex::ex(unsigned long long i) : bp(construct_from_ulonglong(i)) +{ + GINAC_ASSERT(bp->flags & status_flags::dynallocated); +} + inline ex::ex(double const d) : bp(construct_from_double(d)) { @@ -962,6 +978,26 @@ inline void swap(GiNaC::ex &a, GiNaC::ex &b) a.swap(b); } +/** Specialization of std::hash() for ex objects. */ +template<> +struct hash +{ + std::size_t operator()(const GiNaC::ex & e) const noexcept + { + return e.gethash(); + } +}; + +/** Specialization of std::equal_to() for ex objects. */ +template<> +struct equal_to +{ + bool operator()(const GiNaC::ex &e1, const GiNaC::ex &e2) const noexcept + { + return e1.is_equal(e2); + } +}; + } // namespace std #endif // ndef GINAC_EX_H