Commit 69537604 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

ENH: declare generated methods for containers

parent b2713d23
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -105,7 +105,7 @@ SourceFiles
namespace Foam
{
// Forward declarations
// Forward Declarations
template<unsigned Width> class PackedList;
class labelRange;
......@@ -230,7 +230,7 @@ public:
// Constructors
//- Null constructor
//- Default construct, zero-sized and no allocation
inline constexpr PackedList() noexcept;
//- Construct for given number of elements, initializes values to 0
......@@ -451,6 +451,7 @@ public:
class reference
{
protected:
friend class PackedList; // Access for parent
void operator&() = delete; // Refuse to provide its address
......@@ -472,10 +473,16 @@ public:
public:
//- Copy construct
reference(const reference&) = default;
//- Move construct
reference(reference&&) = default;
//- Value assignment
inline void operator=(const reference& other);
//- Value assignment.
//- Value assignment
inline void operator=(const unsigned int val);
//- Conversion operator.
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -54,7 +54,7 @@ See also
namespace Foam
{
// Forward declarations
// Forward Declarations
class bitSet;
class labelRange;
......@@ -131,13 +131,14 @@ public:
class const_iterator;
typedef unsigned int const_reference;
//- Define class name and debug
//- Declare type-name (with debug switch)
ClassName("bitSet");
// Constructors
//- Construct an empty, zero-sized set
//- Default construct an empty, zero-sized set
inline bitSet() noexcept;
//- Construct from Istream
......@@ -438,6 +439,7 @@ public:
public PackedList<1>::reference
{
protected:
friend class bitSet; // Access for parent
void operator&() = delete; // Refuse to provide its address
......@@ -447,6 +449,12 @@ public:
public:
//- Copy construct
reference(const reference&) = default;
//- Move construct
reference(reference&&) = default;
//- Flip the bit at the position, no range-checking
inline void flip();
......@@ -474,7 +482,7 @@ public:
//- Global position of the current \a on bit
label pos_;
//- Construct null - an end iterator
//- Default construct - an end iterator
inline const_iterator() noexcept;
//- Construct begin iterator
......
......@@ -206,7 +206,7 @@ public:
// Constructors
//- Construct null with default (128) table capacity
//- Default construct with default (128) table capacity
HashTable();
//- Construct given initial table capacity
......@@ -550,6 +550,7 @@ protected:
class Iterator
{
public:
// Typedefs
using iterator_category = std::forward_iterator_tag;
using difference_type = this_type::difference_type;
......@@ -671,6 +672,7 @@ public:
public Iterator<false>
{
public:
// Typedefs
using iterator_category = std::forward_iterator_tag;
using difference_type = this_type::difference_type;
......@@ -684,8 +686,8 @@ public:
// Constructors
//- Construct null (end iterator)
inline iterator() = default;
//- Default construct (end iterator)
iterator() = default;
//- Copy construct from similar access type
inline explicit iterator(const Iterator<false>& iter)
......@@ -729,6 +731,7 @@ public:
public Iterator<true>
{
public:
// Typedefs
using iterator_category = std::forward_iterator_tag;
using difference_type = this_type::difference_type;
......@@ -741,8 +744,11 @@ public:
// Constructors
//- Construct null (end iterator)
inline const_iterator() = default;
//- Default construct (end iterator)
const_iterator() = default;
//- Copy construct
const_iterator(const const_iterator&) = default;
//- Copy construct from similar access type
inline explicit const_iterator(const Iterator<true>& iter)
......@@ -781,8 +787,10 @@ public:
inline const_iterator& operator++();
inline const_iterator operator++(int);
// Assignment
//- Copy assignment
const_iterator& operator=(const const_iterator&) = default;
// Allow assign from iterator to const_iterator
......@@ -805,6 +813,7 @@ public:
public Iter
{
public:
using value_type = this_type::key_type;
using reference = const Key&;
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -72,7 +72,7 @@ public:
//- Pointer to next entry in list
link* next_ = nullptr;
//- Null construct
//- Default construct
link() = default;
//- Check if the node is registered with the list
......@@ -85,7 +85,7 @@ public:
private:
// Private Member Data
// Private Data
//- Pointer to first element
link *first_ = nullptr;
......@@ -97,15 +97,6 @@ private:
label size_ = 0;
// Private Member Functions
//- No copy construct
DLListBase(const DLListBase&) = delete;
//- No copy assignment
void operator=(const DLListBase&) = delete;
protected:
// Protected Member Functions
......@@ -142,14 +133,19 @@ public:
friend class const_iterator;
// Constructors
// Generated Methods
//- Null construct
//- Default construct
DLListBase() = default;
//- No copy construct
DLListBase(const DLListBase&) = delete;
//- Destructor
~DLListBase() = default;
//- No copy assignment
void operator=(const DLListBase&) = delete;
//- Destructor
~DLListBase() = default;
// Member Functions
......@@ -233,6 +229,9 @@ public:
public:
//- Copy construct
iterator(const iterator&) = default;
//- Construct for a node on a list
inline iterator(DLListBase* list, link* item);
......@@ -280,15 +279,15 @@ public:
public:
//- Copy construct
const_iterator(const const_iterator&) = default;
//- Construct for a node on a list
inline const_iterator(const DLListBase* list, const link* item);
//- Copy construct from a non-const iterator
inline const_iterator(const DLListBase::iterator& iter);
//- Copy construct
const_iterator(const const_iterator&) = default;
//- The storage node
inline const link* get_node() const;
......@@ -308,6 +307,7 @@ public:
//- Move forward through list
inline void next();
//- Copy assignment
const_iterator& operator=(const const_iterator&) = default;
inline bool operator==(const const_iterator&) const;
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -69,14 +69,14 @@ public:
//- Pointer to next entry in list
link* next_ = nullptr;
//- Null construct
//- Default construct
link() = default;
};
private:
// Private Member Data
// Private Data
//- A pointer to the last element.
// last_->next_ points to first element, i.e. circular storage
......@@ -86,15 +86,6 @@ private:
label size_ = 0;
// Private Member Functions
//- No copy construct
SLListBase(const SLListBase&) = delete;
//- No copy assignment
void operator=(const SLListBase&) = delete;
protected:
// Protected Member Functions
......@@ -130,14 +121,19 @@ public:
friend class const_iterator;
// Constructors
// Generated Methods
//- Null construct
//- Default construct
SLListBase() = default;
//- No copy construct
SLListBase(const SLListBase&) = delete;
//- No copy assignment
void operator=(const SLListBase&) = delete;
//- Destructor
~SLListBase() = default;
//- Destructor
~SLListBase() = default;
// Member Functions
......@@ -209,6 +205,9 @@ public:
public:
//- Copy construct
iterator(const iterator&) = default;
//- Construct for a node on the list
inline iterator(SLListBase* list, link* item);
......@@ -231,6 +230,7 @@ public:
//- Move forward through list
inline void next();
//- Copy assignment
inline void operator=(const iterator& iter);
inline bool operator==(const iterator& iter) const;
......@@ -254,15 +254,15 @@ public:
public:
//- Copy construct
const_iterator(const const_iterator&) = default;
//- Construct for a node on the list
inline const_iterator(const SLListBase* list, const link* item);
//- Construct from a non-const iterator
inline const_iterator(const SLListBase::iterator& iter);
//- Copy construct
const_iterator(const const_iterator&) = default;
//- The storage node
inline const link* get_node() const;
......@@ -282,6 +282,7 @@ public:
//- Move forward through list
inline void next();
//- Copy assignment
const_iterator& operator=(const const_iterator&) = default;
inline bool operator==(const const_iterator& iter) const;
......@@ -306,7 +307,6 @@ public:
//- No reverse iteration
const const_iterator& crend() const = delete;
};
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -135,7 +135,7 @@ public:
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// Static Member Functions
// Static Functions
//- Return a null FixedList
inline static const FixedList<T, N>& null();
......@@ -143,8 +143,8 @@ public:
// Constructors
//- Null constructor
inline FixedList() = default;
//- Default construct
FixedList() = default;
//- Construct and initialize all entries to given value
inline explicit FixedList(const T& val);
......@@ -155,7 +155,7 @@ public:
//- Copy construct from C-array
inline explicit FixedList(const T list[N]);
//- Copy constructor
//- Copy construct
inline FixedList(const FixedList<T, N>& list);
//- Move construct by using move assignment for the individual
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -50,7 +50,7 @@ SourceFiles
namespace Foam
{
// Forward declarations
// Forward Declarations
template<class T> class SubList;
// Common list types
......@@ -70,12 +70,18 @@ class SubList
{
public:
// Static Member Functions
// Static Functions
//- Return a null SubList
inline static const SubList<T>& null();
// Generated Methods
//- Copy construct
SubList(const SubList&) = default;
// Constructors
//- Construct from UList, the entire size
......@@ -122,7 +128,7 @@ public:
//- Copy assign entries from given sub-list
inline void operator=(const SubList<T>& list);
//- Copy assign entries to the given list
//- Copy assign entries from given list
inline void operator=(const UList<T>& list);
//- Assign all entries to the given value
......
......@@ -66,7 +66,7 @@ SourceFiles
namespace Foam
{
// Forward declarations
// Forward Declarations
class labelRange;
template<class T> class List;
template<class T> class SubList;
......@@ -87,7 +87,7 @@ typedef UList<label> labelUList; //!< A UList of labels
template<class T>
class UList
{
// Private data
// Private Data
//- Number of elements in UList
label size_;
......@@ -167,13 +167,13 @@ public:
friend class SubList<T>;
// Static Member Functions
// Static Functions
//- Return a UList reference to a nullObject
inline static const UList<T>& null();
// Public classes
// Public Classes
//- A list compare binary predicate for normal sort
struct less
......@@ -208,9 +208,15 @@ public:
};
// Generated Methods
//- Copy construct
UList(const UList<T>&) = default;
// Constructors
//- Null constructor
//- Default construct, zero-sized and nullptr
inline constexpr UList() noexcept;
//- Construct from components
......@@ -331,7 +337,7 @@ public:
void deepCopy(const UList<T>& list);
// Member operators
// Member Operators
//- Return element of UList
inline T& operator[](const label i);
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -75,8 +75,8 @@ public:
// Constructors
//- Construct null
inline Tuple2() = default;
//- Default construct
Tuple2() = default;
//- Copy construct from components
inline Tuple2(const T1& f, const T2& s)
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -65,8 +65,8 @@ public:
// Constructors
//- Construct an empty list
inline hashedWordList() = default;
//- Default construct an empty list
hashedWordList() = default;
//- Copy construct.
inline hashedWordList(const hashedWordList& list);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment