Skip to content

Commit 1aa37db

Browse files
Changes to NullPtrTable, NullPtrVector to remove unneeded methods.
Also added const qualifier to enable deployment of NullPtrTable to work.
1 parent c3a3f01 commit 1aa37db

File tree

1 file changed

+4
-59
lines changed

1 file changed

+4
-59
lines changed

dpctl/tensor/libtensor/include/utils/type_dispatch.hpp

Lines changed: 4 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -337,87 +337,32 @@ template <typename T> struct GetTypeid
337337
template <typename FunPtrT> struct NullPtrVector
338338
{
339339

340-
using iterator_category = std::forward_iterator_tag;
341-
using different_type = std::ptrdiff_t;
342340
using value_type = FunPtrT;
343-
using pointer = value_type *;
344-
using reference = value_type &;
341+
using const_reference = value_type const &;
345342

346343
NullPtrVector() : val(nullptr) {}
347344

348-
reference operator*()
345+
const_reference operator[](int) const
349346
{
350347
return val;
351348
}
352349

353-
reference operator[](int)
354-
{
355-
return val;
356-
}
357-
358-
NullPtrVector<FunPtrT> &operator++()
359-
{
360-
return *this;
361-
}
362-
NullPtrVector<FunPtrT> operator++(int)
363-
{
364-
return *this;
365-
}
366-
367-
friend bool operator==(const NullPtrVector<FunPtrT> &a,
368-
const NullPtrVector<FunPtrT> &b)
369-
{
370-
return true;
371-
}
372-
friend bool operator!=(const NullPtrVector<FunPtrT> &a,
373-
const NullPtrVector<FunPtrT> &b)
374-
{
375-
return false;
376-
}
377-
378350
private:
379351
value_type val;
380352
};
381353

382354
/*! @brief Class to generate table of null function pointers */
383355
template <typename FunPtrT> struct NullPtrTable
384356
{
385-
using iterator_category = std::forward_iterator_tag;
386-
using different_type = std::ptrdiff_t;
387357
using value_type = NullPtrVector<FunPtrT>;
388-
using pointer = value_type *;
389-
using reference = value_type &;
358+
using const_reference = value_type const &;
390359

391360
NullPtrTable() : val() {}
392361

393-
reference operator*()
362+
const_reference operator[](int) const
394363
{
395364
return val;
396365
}
397-
reference operator[](int)
398-
{
399-
return val;
400-
}
401-
402-
NullPtrTable<FunPtrT> &operator++()
403-
{
404-
return *this;
405-
}
406-
NullPtrTable<FunPtrT> operator++(int)
407-
{
408-
return *this;
409-
}
410-
411-
friend bool operator==(const NullPtrTable<FunPtrT> &a,
412-
const NullPtrTable<FunPtrT> &b)
413-
{
414-
return true;
415-
}
416-
friend bool operator!=(const NullPtrTable<FunPtrT> &a,
417-
const NullPtrTable<FunPtrT> &b)
418-
{
419-
return false;
420-
}
421366

422367
private:
423368
value_type val;

0 commit comments

Comments
 (0)