Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal Class Reference

helper class for iteration More...

Public Types

using difference_type = std::ptrdiff_t
 
using value_type = iteration_proxy_internal
 
using pointer = iteration_proxy_internal *
 
using reference = iteration_proxy_internal &
 
using iterator_category = std::input_iterator_tag
 

Public Member Functions

 iteration_proxy_internal (IteratorType it) noexcept
 
iteration_proxy_internaloperator* ()
 dereference operator (needed for range-based for) More...
 
iteration_proxy_internaloperator++ ()
 increment operator (needed for range-based for) More...
 
bool operator== (const iteration_proxy_internal &o) const noexcept
 equality operator (needed for InputIterator) More...
 
bool operator!= (const iteration_proxy_internal &o) const noexcept
 inequality operator (needed for range-based for) More...
 
const std::stringkey () const
 return key of the iterator More...
 
IteratorType::reference value () const
 return value of the iterator More...
 

Private Attributes

IteratorType anchor
 the iterator More...
 
std::size_t array_index = 0
 an index for arrays (used to create key names) More...
 
std::size_t array_index_last = 0
 last stringified array index More...
 
std::string array_index_str = "0"
 a string representation of the array index More...
 
const std::string empty_str = ""
 an empty string (to return a reference for primitive values) More...
 

Detailed Description

template<typename IteratorType>
class nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal

helper class for iteration

Definition at line 1610 of file json.hpp.

Member Typedef Documentation

template<typename IteratorType>
using nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal::difference_type = std::ptrdiff_t

Definition at line 1613 of file json.hpp.

template<typename IteratorType>
using nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal::iterator_category = std::input_iterator_tag

Definition at line 1617 of file json.hpp.

template<typename IteratorType>
using nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal::pointer = iteration_proxy_internal*

Definition at line 1615 of file json.hpp.

template<typename IteratorType>
using nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal::reference = iteration_proxy_internal&

Definition at line 1616 of file json.hpp.

Definition at line 1614 of file json.hpp.

Constructor & Destructor Documentation

template<typename IteratorType>
nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal::iteration_proxy_internal ( IteratorType  it)
inlineexplicitnoexcept

Definition at line 1632 of file json.hpp.

1632 : anchor(it) {}

Member Function Documentation

template<typename IteratorType>
const std::string& nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal::key ( ) const
inline

return key of the iterator

Definition at line 1662 of file json.hpp.

References nlohmann::detail::array, and nlohmann::detail::object.

1663  {
1664  assert(anchor.m_object != nullptr);
1665 
1666  switch (anchor.m_object->type())
1667  {
1668  // use integer array index as key
1669  case value_t::array:
1670  {
1672  {
1673  array_index_str = std::to_string(array_index);
1675  }
1676  return array_index_str;
1677  }
1678 
1679  // use key from the object
1680  case value_t::object:
1681  return anchor.key();
1682 
1683  // use an empty key for all primitive types
1684  default:
1685  return empty_str;
1686  }
1687  }
std::string array_index_str
a string representation of the array index
Definition: json.hpp:1627
array (ordered collection of values)
std::size_t array_index
an index for arrays (used to create key names)
Definition: json.hpp:1623
object (unordered set of name/value pairs)
std::size_t array_index_last
last stringified array index
Definition: json.hpp:1625
const std::string empty_str
an empty string (to return a reference for primitive values)
Definition: json.hpp:1629
template<typename IteratorType>
bool nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal::operator!= ( const iteration_proxy_internal o) const
inlinenoexcept

inequality operator (needed for range-based for)

Definition at line 1656 of file json.hpp.

1657  {
1658  return anchor != o.anchor;
1659  }
template<typename IteratorType>
iteration_proxy_internal& nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal::operator* ( )
inline

dereference operator (needed for range-based for)

Definition at line 1635 of file json.hpp.

1636  {
1637  return *this;
1638  }
template<typename IteratorType>
iteration_proxy_internal& nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal::operator++ ( )
inline

increment operator (needed for range-based for)

Definition at line 1641 of file json.hpp.

1642  {
1643  ++anchor;
1644  ++array_index;
1645 
1646  return *this;
1647  }
std::size_t array_index
an index for arrays (used to create key names)
Definition: json.hpp:1623
template<typename IteratorType>
bool nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal::operator== ( const iteration_proxy_internal o) const
inlinenoexcept

equality operator (needed for InputIterator)

Definition at line 1650 of file json.hpp.

1651  {
1652  return anchor == o.anchor;
1653  }
template<typename IteratorType>
IteratorType::reference nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal::value ( ) const
inline

return value of the iterator

Definition at line 1690 of file json.hpp.

1691  {
1692  return anchor.value();
1693  }

Member Data Documentation

template<typename IteratorType>
IteratorType nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal::anchor
private

the iterator

Definition at line 1621 of file json.hpp.

template<typename IteratorType>
std::size_t nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal::array_index = 0
private

an index for arrays (used to create key names)

Definition at line 1623 of file json.hpp.

template<typename IteratorType>
std::size_t nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal::array_index_last = 0
mutableprivate

last stringified array index

Definition at line 1625 of file json.hpp.

template<typename IteratorType>
std::string nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal::array_index_str = "0"
mutableprivate

a string representation of the array index

Definition at line 1627 of file json.hpp.

template<typename IteratorType>
const std::string nlohmann::detail::iteration_proxy< IteratorType >::iteration_proxy_internal::empty_str = ""
private

an empty string (to return a reference for primitive values)

Definition at line 1629 of file json.hpp.


The documentation for this class was generated from the following file: