<commit_before>#ifndef GLCXX_PROGRAM_HPP
#define GLCXX_PROGRAM_HPP

#include <initializer_list>
#include <memory>
#include "glcxx/Shader.hpp"

namespace glcxx
{
    class Program
    {
        public:
            Program();

            ~Program();

            GLuint id() const { return m_id; }

            void use() const { glUseProgram(m_id); }

            bool valid() const { return m_id > 0u; }

            template <typename... Shaders>
            void create(Shaders... shaders)
            {
                allocate();
                _create(shaders...);
            }

            void attach_shader(const Shader & shader) const
            {
                glAttachShader(m_id, shader.id());
            }

            void attach_shader(std::unique_ptr<Shader> shader) const
            {
                glAttachShader(m_id, shader->id());
            }

            void attach_shader(std::shared_ptr<Shader> shader) const
            {
                glAttachShader(m_id, shader->id());
            }

            void bind_attribute(const char * name, GLuint index) const
            {
                glBindAttribLocation(m_id, index, name);
            }

            template <typename... Args>
            void bind_attributes(const char * name, GLuint index, Args... args) const
            {
                bind_attribute(name, index);
                bind_attributes(args...);
            }

            GLint get_uniform_location(const char * uniform_name)
            {
                return glGetUniformLocation(m_id, uniform_name);
            }

        protected:
            void allocate();

            void _create() const;

            template <typename T, typename... Shaders>
            void _create(T shader, Shaders... args) const
            {
                attach_shader(shader);
                _create(args...);
            }

            GLuint m_id;
    };
};

#endif<commit_msg>allow binding attributes as part of the Program.create() call<commit_after>#ifndef GLCXX_PROGRAM_HPP
#define GLCXX_PROGRAM_HPP

#include <initializer_list>
#include <memory>
#include "glcxx/Shader.hpp"

namespace glcxx
{
    class Program
    {
        public:
            Program();

            ~Program();

            GLuint id() const { return m_id; }

            void use() const { glUseProgram(m_id); }

            bool valid() const { return m_id > 0u; }

            template <typename... Shaders>
            void create(Shaders... shaders)
            {
                allocate();
                _create(shaders...);
            }

            void attach_shader(const Shader & shader) const
            {
                glAttachShader(m_id, shader.id());
            }

            void attach_shader(std::unique_ptr<Shader> shader) const
            {
                glAttachShader(m_id, shader->id());
            }

            void attach_shader(std::shared_ptr<Shader> shader) const
            {
                glAttachShader(m_id, shader->id());
            }

            GLint get_uniform_location(const char * uniform_name)
            {
                return glGetUniformLocation(m_id, uniform_name);
            }

        protected:
            void allocate();

            void _create() const;

            template <typename... Shaders>
            void _create(const Shader & shader, Shaders... args) const
            {
                attach_shader(shader);
                _create(args...);
            }

            template <typename... Shaders>
            void _create(std::unique_ptr<Shader> shader, Shaders... args) const
            {
                attach_shader(shader);
                _create(args...);
            }

            template <typename... Shaders>
            void _create(std::shared_ptr<Shader> shader, Shaders... args) const
            {
                attach_shader(shader);
                _create(args...);
            }

            template <typename... Shaders>
            void _create(const char * attribute_name, GLuint index, Shaders... args) const
            {
                glBindAttribLocation(m_id, index, attribute_name);
                _create(args...);
            }

            GLuint m_id;
    };
};

#endif
{'fraction_non_alphanumeric': 0.10018859028760019, 'fraction_numerical': 0.0004714757190004715, 'mean_word_length': 1.37703081232493, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3483193', 'n_tokens_mistral': 1166, 'n_tokens_neox': 1100, 'n_words': 245}