Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis15/src/lib/include/diderot/dynseq.hxx
ViewVC logotype

Diff of /branches/vis15/src/lib/include/diderot/dynseq.hxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4027, Wed Jun 22 17:38:35 2016 UTC revision 4028, Wed Jun 22 21:15:36 2016 UTC
# Line 23  Line 23 
23  // QUESTION: can we use some type-level hacking to connect the base element type, shape,  // QUESTION: can we use some type-level hacking to connect the base element type, shape,
24  // and sequence element type together (would help with resolving loading too)?  // and sequence element type together (would help with resolving loading too)?
25    
26        namespace __details {
27            template <typename T> using load_fn_ptr = T (*) (const void *);
28        } // __details
29    
30      template <typename T> struct dynseq_traits;      template <typename T> struct dynseq_traits;
31      // using value_type = ...;      // using value_type = ...;
32      // using base_type = ...;      // using base_type = ...;
33        // static __details::load_fn_ptr<base_type> get_load_fn (int ty);
34        // static const uint32_t ndims;
35        // static const uint32_t dims[ndims] = { ... };
36    
37      template <typename T>      template <typename T>
38      class dynseq {      class dynseq {
39        public:        public:
40    
41            using traits = dynseq_traits<T>;
42    
43        //! construct an empty sequence        //! construct an empty sequence
44          dynseq ();          dynseq ();
45          //! construct an uninitialized sequence with the given number of elements
46            dynseq (uint32_t n);
47        //! construct a sequence from a fixed-size array        //! construct a sequence from a fixed-size array
48          dynseq (uint32_t n, const T *data);          dynseq (uint32_t n, const T *data);
49        //! construct a sequence from an array initializer (e.g., `dynseq{1, 2, 3}`)        //! construct a sequence from an array initializer (e.g., `dynseq{1, 2, 3}`)
# Line 95  Line 106 
106      { }      { }
107    
108      template <typename T>      template <typename T>
109        dynseq<T>::dynseq (uint32_t nelems)
110            : _seq(std::make_shared<std::vector<T>>(std::vector<T>(n)))
111        { }
112    
113        template <typename T>
114      dynseq<T>::dynseq (uint32_t n, const T *data)      dynseq<T>::dynseq (uint32_t n, const T *data)
115          : _seq(std::make_shared<std::vector<T>>(std::vector<T>()))          : _seq(std::make_shared<std::vector<T>>(std::vector<T>()))
116      {      {

Legend:
Removed from v.4027  
changed lines
  Added in v.4028

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0