Questions tagged [template]

a design structure for creating several things that are almost identical but need different values. Not template-meta-programming.

Filter by
Sorted by
Tagged with
1
vote
0answers
421 views

A simple and efficient packet frame encoder/decoder

I have written a simple packet-framing class, for converting un-encoded 'packets' into encoded/delimited 'frames,' to be sent over a P2P serial connection. The functionality is based on the RFC 1662 "...
1
vote
0answers
33 views

Type conversion between Node, Const_node, and their views

Each node is a location within a layer. A Location may be a pointer or an index. A Layer is a container. There are 4 types of ...
1
vote
0answers
59 views

Type System for Layers and Nodes

Overview The following is a type system of layers (A, B, C, ...
1
vote
0answers
52 views

Creating objects by defined name

I'm trying to write universal factory creating objects by name. I've got some working prototype now but there must be a better way than casting construction methods to void pointer. ...
1
vote
1answer
24 views

DRY for rendering same header table for different content

I'm trying to make the following code DRY. The code outputs a table that shows violations. If there is any violation.status = resolved they go in separate table for ...
1
vote
0answers
334 views

WPF “Glowing” button user control

I have created a "wrapper" for a button that "pulses" until the user presses the button. The implementation that I came up with is below, but I'm sure there's a better approach. ...
1
vote
0answers
336 views

A homemade variadic map

A bit of background: some time ago I wrote a piece of code that can be used for memoization with functions taking one parameter. Now I want to extend this to deal with functions with arbitrary number ...
1
vote
0answers
78 views

Fast HashIndex (HashTable) “template” for indexes and arrays C++

Another in the long line of data structures I'm writing for my 2D isometric game. This is a hashtable that only handles indexes, hence eHashIndex. It does not copy ...
1
vote
0answers
43 views

Modular widget that minimizes js and css scope pollution

So, my goal with this is to create a simple login widget that does as close to nothing to the global scope as possible. The login mechanism is less important than the encapsulation. The whole script ...
1
vote
0answers
29 views

Better way to template in simple coffee script

I am looking to see if there is a better way to refactor the creatMessage such that the logic of identifying message elements is outside the actual message ...
1
vote
0answers
221 views

Specialized template methods with complex numbers class

Suppose I have a class of complex numbers called Complex and I wish to implement a class of generic matrices with transpose operation. ...
1
vote
0answers
974 views

PHP Web Components

I read about W3C Web Components spec and JavaScript's libraries like polymer.js and others, so I tried to find something similar in PHP, but with no luck. So I wrote a tiny class to work with custom ...
1
vote
0answers
238 views

Templating engine that uses closures to eliminate iterative includes

This is the second submission for Code Review for this project, but since the API changed considerably I felt it should not be attached to the original post. To see the original post and comment see ...
0
votes
2answers
107 views

Reach C++ policy-based common interface with different template parameters from one container

Please review my solution for the following problem. I am interested in: What do you think of the design Improvement tips Usability Efficiency Problem: Need to be store policy-based objects with ...
0
votes
1answer
150 views

Vector classes implementation in C++

i have rewritten a vector classes similar to the glm library which is used mostly in opengl application. i would like to know how can i improve it further ? Types.hpp ...
0
votes
2answers
2k views

C++ binary search tree with templates

I implemented a binary search tree with methods of insert, search, size and print using the << operator. All the methods works with ...
0
votes
2answers
155 views

Create a template class for same algorithm different type of member variable

I want a template class that defines the same algorithms, but can work on different type of data stored in a member variable. The exact type of data ideally depends only on a single template parameter....
0
votes
1answer
126 views

RAII object for releasing pointer with arbitrary function

The following class is a sort of "smart pointer" that can be used for automatically releasing pointers: ...
0
votes
1answer
158 views

HTML template for win-loss data in Javascript with Mustache

Can anyone suggest a better way to implement my template code? ...
0
votes
1answer
95 views

Designing a generic C++1z class [closed]

I'm designing a generic interface for a MessageEntry class for a .h file. I'm looking for guidance on form and terminology (would I call this an interface/template/generic class?): ...
0
votes
1answer
50 views

Generate a text file representing an email for a job application followup

Purpose: After you've submitted a resume and cover letter for a job position, you haven't heard anything back, so you decided to send a follow up email. The script generates the follow up e-mail based ...
0
votes
1answer
28 views

Injecting a set of files in a Thymeleaf template while keeping the amount of tags at a minimum

I use a Thymeleaf template to inject a set of files (which contain precalculated HTML) into one big HTML. The files with their metadata are stored in a map called ...
0
votes
1answer
45 views

PHP simple template loader

This is not really a question but I'd like to obtain some opinions about this simple class. For an old project I had the necessity to load some php template files that includes some ...
0
votes
1answer
178 views

C++ implementation of quicksort with iterators (unstable sorting)

Please review the following quicksort implementation. qsort below is intentionally unstable, as partition reoders equal elements....
0
votes
1answer
3k views

Dynamically set angular directive template

I have recently upgraded to AngularJS 1.5 and as the title says, I want to use different templates depending on a value in the ...
0
votes
1answer
99 views

User and Score models

I have a couple of models - User & Score. I am displaying data from those models to my template. Data from ...
0
votes
1answer
247 views

Prefered Style Container for the Components in the DataTemplate

The following XAML is a close (tidied up) version of what I have use in my WPF application. If you have noticed there are two Styles applied to the same component (<...
0
votes
0answers
47 views

Helper to convert arbitrary function into a custom deleter

If you want to use a custom deleter in unique_ptr you either have to pass a functor or the signature of a delete function as template argument. If you have a ...
0
votes
0answers
33 views

Templated JSON parsing methods that work with an element or elements array

Consider the following two Java methods. The first takes a JSON string representing one element, the second representing multiple elements. gson.fromJson() can be ...
0
votes
0answers
19 views

Optimizing Datatables table of tens of thousands of client-provided rows

We have this employees table, that looks like this: that contains 16,530 employee rows. As expected, this table takes more than 30 seconds to load. I have been tasked with speeding it up somehow. ...
0
votes
1answer
98 views

React components to render two kinds of form elements

I have two React components. The only difference is the input tag vs select tag. I'm trying to move the bulk of the duplicate code to a higher order component but I can't wrap my head around it. Any ...
-1
votes
1answer
115 views

Using templates and function overloads to set DOM attributes [closed]

I'm making a library to build and manage a website. I want to control what gets to be inserted. For example I don't want to be able to insert ...
-2
votes
1answer
63 views

Is this a good/bad/ugly way of assigning unique IDs to objects in C++? [closed]

My project has many different objects from different classes, and I want each object to have a unique ID. IDs should be unique within each class type, but can be the same among different classes. For ...
-5
votes
2answers
164 views

Using templates for constant and volatile [closed]

First some motivation: I can never remember where the const or volatile specifiers goes in a declaration. For example: ...